aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-08-07 15:34:10 +0200
committerJosé Valim <jose.valim@gmail.com>2009-08-07 17:17:51 +0200
commit55575e21655023259d0dae22bc1b148b34168d92 (patch)
tree9df9d486c182686d0282e52ce1ec1d6eadee68d5 /railties/test
parentaed135d3e261cbee153a35fcfbeb47e2e02b12e4 (diff)
downloadrails-55575e21655023259d0dae22bc1b148b34168d92.tar.gz
rails-55575e21655023259d0dae22bc1b148b34168d92.tar.bz2
rails-55575e21655023259d0dae22bc1b148b34168d92.zip
Allow rails templates relative to the current path to be given.
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