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

add engine's namespace to fixture name

上级 6a8d9189
......@@ -15,6 +15,15 @@ def create_test_files
File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
end
def fixture_name
@fixture_name ||=
if defined?(ENGINE_ROOT)
namespaced_path + "_" + table_name
else
table_name
end
end
private
def attributes_hash
......
......@@ -3,7 +3,7 @@
<% module_namespacing do -%>
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
setup do
@<%= singular_table_name %> = <%= table_name %>(:one)
@<%= singular_table_name %> = <%= fixture_name %>(:one)
<% if defined?(ENGINE_ROOT) -%>
@routes = Engine.routes
<% end -%>
......
......@@ -521,6 +521,7 @@ def test_generating_scaffold_controller_inside_mountable_engine
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册