提交 36127934 编写于 作者: Y yuuji.yaginuma

add test to run generated test files inside mountable engine

上级 c861ef28
......@@ -508,22 +508,6 @@ def test_generating_controller_inside_mountable_engine
assert_match(/namespace :admin/, contents)
assert_no_match(/namespace :bukkit/, contents)
end
assert_file "test/controllers/bukkits/admin/dashboard_controller_test.rb" do |contents|
assert_match(/@routes = Engine.routes/, contents)
end
end
def test_generating_scaffold_controller_inside_mountable_engine
run_generator [destination_root, "--mountable"]
capture(:stdout) do
`#{destination_root}/bin/rails g scaffold User name:string age:integer`
end
assert_file "test/controllers/bukkits/users_controller_test.rb" do |contents|
assert_match(/@user = bukkits_users\(:one\)/, contents)
assert_match(/@routes = Engine.routes/, contents)
end
end
def test_git_name_and_email_in_gemspec_file
......
......@@ -174,4 +174,15 @@ def test_model_name_option
end
end
end
def test_controller_tests_pass_by_default_inside_mountable_engine
Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --mountable` }
engine_path = File.join(destination_root, "bukkits")
Dir.chdir(engine_path) do
quietly { `bin/rails g controller dashboard foo` }
assert_match(/2 runs, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test 2>&1`)
end
end
end
......@@ -393,4 +393,18 @@ def test_scaffold_generator_password_digest
assert_match(/password_digest: <%= BCrypt::Password.create\('secret'\) %>/, content)
end
end
def test_scaffold_tests_pass_by_default_inside_mountable_engine
Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --mountable` }
engine_path = File.join(destination_root, "bukkits")
Dir.chdir(engine_path) do
quietly do
`bin/rails g scaffold User name:string age:integer;
bundle exec rake db:migrate`
end
assert_match(/8 runs, 13 assertions, 0 failures, 0 errors/, `bundle exec rake test 2>&1`)
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册