aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/rake/templates_test.rb
blob: 1fca80debd4dfc3f4c5d301e6a4f3362f86265cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require "isolation/abstract_unit"

module ApplicationTests
  module RakeTests
    class TemplatesTest < ActiveSupport::TestCase
      include ActiveSupport::Testing::Isolation

      def setup
        build_app
        require "rails/all"
        super
      end

      def teardown
        super
        teardown_app
      end

      def test_rake_template
        Dir.chdir(app_path) do
          cmd = "bundle exec rake rails:template LOCATION=foo"
          r,w = IO.pipe
          Process.waitpid Process.spawn(cmd, out: w, err: w)
          w.close
          assert_match(/Could not find.*foo/, r.read)
          r.close
        end
      end
    end
  end
end