aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/fixtures/lib/template.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb5
-rw-r--r--railties/test/generators/generators_test_helper.rb2
3 files changed, 7 insertions, 1 deletions
diff --git a/railties/test/fixtures/lib/template.rb b/railties/test/fixtures/lib/template.rb
new file mode 100644
index 0000000000..c14a1a8784
--- /dev/null
+++ b/railties/test/fixtures/lib/template.rb
@@ -0,0 +1 @@
+say "It works from file!"
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index c794a2ade6..19e41c15c8 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -131,6 +131,11 @@ class AppGeneratorTest < GeneratorsTestCase
assert_file 'config/environment.rb', /# RAILS_GEM_VERSION/
end
+ def test_template_from_dir_pwd
+ FileUtils.cd(RAILS_ROOT)
+ assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"])
+ end
+
def test_template_raises_an_error_with_invalid_path
content = capture(:stderr){ run_generator(["-m", "non/existant/path"]) }
assert_match /The template \[.*\] could not be loaded/, content
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 011bd518f8..9444a9ed4b 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -20,7 +20,7 @@ class GeneratorsTestCase < Test::Unit::TestCase
def destination_root
@destination_root ||= File.expand_path(File.join(File.dirname(__FILE__),
- '..', '..', 'fixtures', 'tmp'))
+ '..', 'fixtures', 'tmp'))
end
def setup