aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2011-06-06 17:23:11 +1000
committerStefan Sprenger <stefan.sprenger@dkd.de>2011-06-07 08:32:03 +0200
commit77616702df35da2f095dfbaf229b0ae500eaa113 (patch)
treea10122a7fd4fd133d79d0de12f0e1e4d9f40b8c9 /railties/test
parent32d35bac09a2d9c86d8893384959c7811df50130 (diff)
downloadrails-77616702df35da2f095dfbaf229b0ae500eaa113.tar.gz
rails-77616702df35da2f095dfbaf229b0ae500eaa113.tar.bz2
rails-77616702df35da2f095dfbaf229b0ae500eaa113.zip
Clean up engine generators_test code and add test for models correctly namespaced
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/engine/generators_test.rb26
1 files changed, 19 insertions, 7 deletions
diff --git a/railties/test/engine/generators_test.rb b/railties/test/engine/generators_test.rb
index 6b2c83275b..f335c16a8c 100644
--- a/railties/test/engine/generators_test.rb
+++ b/railties/test/engine/generators_test.rb
@@ -29,26 +29,38 @@ module EngineTests
def engine_path
tmp_path('foo_bar')
end
-
- def build_engine
- FileUtils.mkdir_p(engine_path)
- FileUtils.rm_r(engine_path)
+
+ def rails(cmd)
environment = File.expand_path('../../../../load_paths', __FILE__)
if File.exist?("#{environment}.rb")
require_environment = "-r #{environment}"
end
- `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails plugin new #{engine_path} --full --mountable`
+ `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails #{cmd}`
+ end
+
+ def build_engine
+ FileUtils.mkdir_p(engine_path)
+ FileUtils.rm_r(engine_path)
+
+ rails("plugin new #{engine_path} --full --mountable")
end
def setup
build_engine
end
- def test_omg
+ def test_controllers_are_correctly_namespaced
Dir.chdir(engine_path) do
- `rails g controller topics`
+ rails("g controller topics")
assert_file "app/controllers/foo_bar/topics_controller.rb"
end
end
+
+ def test_models_are_correctly_namespaced
+ Dir.chdir(engine_path) do
+ rails("g model topic")
+ assert_file "app/models/foo_bar/topic.rb"
+ end
+ end
end
end