Add test for helper generator

This commit is contained in:
Stefan Sprenger 2011-06-07 09:31:07 +02:00
parent a60624d6c0
commit 5afd83c03b
1 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,7 @@ module EngineTests
tmp_path('foo_bar') tmp_path('foo_bar')
end end
def bundle_exec(cmd) def bundled_rails(cmd)
`bundle exec rails #{cmd}` `bundle exec rails #{cmd}`
end end
@ -68,16 +68,23 @@ module EngineTests
def test_controllers_are_correctly_namespaced def test_controllers_are_correctly_namespaced
Dir.chdir(engine_path) do Dir.chdir(engine_path) do
bundle_exec("g controller topics") bundled_rails("g controller topics")
assert_file "app/controllers/foo_bar/topics_controller.rb", /FooBar::TopicsController/ assert_file "app/controllers/foo_bar/topics_controller.rb", /FooBar::TopicsController/
end end
end end
def test_models_are_correctly_namespaced def test_models_are_correctly_namespaced
Dir.chdir(engine_path) do Dir.chdir(engine_path) do
bundle_exec("g model topic") bundled_rails("g model topic")
assert_file "app/models/foo_bar/topic.rb", /FooBar::Topic/ assert_file "app/models/foo_bar/topic.rb", /FooBar::Topic/
end end
end end
def test_helpers_are_correctly_namespaced
Dir.chdir(engine_path) do
bundled_rails("g helper topics")
assert_file "app/helpers/foo_bar/topics_helper.rb", /FooBar::TopicsHelper/
end
end
end end
end end