lib/generators/minitest/scaffold/templates/controller_spec.rb in minitest-rails-2.1.1 vs lib/generators/minitest/scaffold/templates/controller_spec.rb in minitest-rails-2.2.0

- old
+ new

@@ -1,51 +1,49 @@ require "test_helper" <% module_namespacing do -%> describe <%= controller_class_name %>Controller do - let(:<%= singular_table_name %>) { <%= table_name %> :one } it "gets index" do get :index - assert_response :success - assert_not_nil assigns(:<%= table_name %>) + value(response).must_be :success? + value(assigns(:<%= table_name %>)).wont_be :nil? end it "gets new" do get :new - assert_response :success + value(response).must_be :success? end it "creates <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count') do + expect { post :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %> - end + }.must_change "<%= class_name %>.count" - assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) + must_redirect_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) end it "shows <%= singular_table_name %>" do get :show, id: <%= singular_table_name %> - assert_response :success + value(response).must_be :success? end it "gets edit" do get :edit, id: <%= singular_table_name %> - assert_response :success + value(response).must_be :success? end it "updates <%= singular_table_name %>" do put :update, id: <%= singular_table_name %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> - assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) + must_redirect_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) end it "destroys <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count', -1) do + expect { delete :destroy, id: <%= singular_table_name %> - end + }.must_change "<%= class_name %>.count", -1 - assert_redirected_to <%= index_helper %>_path + must_redirect_to <%= index_helper %>_path end - end <% end -%>