Use short-form for the scaffold render calls and drop the needless test

上级 75e0ee86
......@@ -31,7 +31,7 @@ def create
if @<%= orm_instance.save %>
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %>
else
render action: 'new'
render :new
end
end
......@@ -40,7 +40,7 @@ def update
if @<%= orm_instance.update("#{singular_table_name}_params") %>
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %>
else
render action: 'edit'
render :edit
end
end
......
......@@ -160,13 +160,6 @@ def self.all(klass)
Unknown::Generators.send :remove_const, :ActiveModel
end
def test_new_hash_style
run_generator
assert_file "app/controllers/users_controller.rb" do |content|
assert_match(/render action: 'new'/, content)
end
end
def test_model_name_option
run_generator ["Admin::User", "--model-name=User"]
assert_file "app/controllers/admin/users_controller.rb" do |content|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册