Sha256: f74eb10f2a22ed58ed6c815e1cca7ee4655588e95ed3198b11768ac92dfdf6f6
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require "minitest_helper" <% module_namespacing do -%> class <%= class_name %>ControllerTest < MiniTest::Rails::Controller setup do @<%= singular_table_name %> = <%= table_name %>(:one) end def test_index get :index assert_response :success assert_not_nil assigns(:<%= table_name %>) end def test_new get :new assert_response :success end def test_create assert_difference('<%= class_name %>.count') do post :create, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %> end assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) end def test_show get :show, <%= key_value :id, "@#{singular_table_name}.to_param" %> assert_response :success end def test_edit get :edit, <%= key_value :id, "@#{singular_table_name}.to_param" %> assert_response :success end def test_update put :update, <%= key_value :id, "@#{singular_table_name}.to_param" %>, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %> assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) end def test_destroy assert_difference('<%= class_name %>.count', -1) do delete :destroy, <%= key_value :id, "@#{singular_table_name}.to_param" %> end assert_redirected_to <%= index_helper %>_path end end <% end -%>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
minitest-rails-0.0.5 | lib/generators/mini_test/scaffold/templates/controller_test.rb |
minitest-rails-0.0.4 | lib/generators/mini_test/scaffold/templates/controller_test.rb |