Sha256: b653eeb094668d251d50b4809459bc85eaad64b4bcdea9f96bd981aca2d27c5c

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

require 'test_helper'

<% module_namespacing do -%>
class <%= prefixed_controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest
  setup do
    @<%= singular_table_name %> = <%= table_name %>(:one)
  end

  test "should get index" do
    get <%= prefixed_index_helper %>_url
    assert_response :success
  end

  test "should get new" do
    get new_<%= prefixed_plain_model_url %>_url
    assert_response :success
  end

  test "should create <%= singular_table_name %>" do
    assert_difference('<%= class_name %>.count') do
      post <%= prefixed_index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
    end

    assert_redirected_to <%= prefixed_plain_model_url %>_url(<%= singular_table_name_camelcase %>.last)
  end

  test "should show <%= singular_table_name %>" do
    get <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>)
    assert_response :success
  end

  test "should get edit" do
    get edit_<%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>)
    assert_response :success
  end

  test "should update <%= singular_table_name %>" do
    patch <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>), params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
    assert_redirected_to <%= prefixed_plain_model_url %>_url(<%= singular_table_name_camelcase %>.last)
  end

  test "should destroy <%= singular_table_name %>" do
    assert_difference('<%= class_name %>.count', -1) do
      delete <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>)
    end

    assert_redirected_to <%= prefixed_index_helper %>_url
  end
end
<% end -%>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
admin_help-0.1.5 lib/generators/admin/scaffold_controller/templates/tests/test_unit/functional_test.rb.erb
admin_help-0.1.4 lib/generators/admin/scaffold_controller/templates/tests/test_unit/functional_test.rb.erb
admin_help-0.1.3 lib/generators/admin/scaffold_controller/templates/tests/test_unit/functional_test.rb.erb