Sha256: 5873f21b7cc7c3270eb0e25d2ba56a5c9ba5615d5d92145765c2307b7303e972

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

class <%= plural_class_name %>ControllerTest < ActionController::TestCase
  setup do
    @<%= singular_name %> = <%= plural_name %>(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:<%= plural_name %>)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create <%= singular_name %>" do
    assert_difference('<%= class_name %>.count') do
      post :create, :<%= singular_name %> => @<%= singular_name %>.attributes
    end

    assert_redirected_to admin_<%= singular_name %>_path(assigns(:<%= singular_name %>))
  end

  test "should show <%= singular_name %>" do
    get :show, :id => @<%= singular_name %>.to_param
    assert_response :success
  end

  test "should get edit" do
    get :edit, :id => @<%= singular_name %>.to_param
    assert_response :success
  end

  test "should update post" do
    put :update, :id => @<%= singular_name %>.to_param, :<%= singular_name %> => @<%= singular_name %>.attributes
    assert_redirected_to admin_<%= singular_name %>_path(assigns(:<%= singular_name %>))
  end

  test "should destroy <%= singular_name %>" do
    assert_difference('<%= class_name %>.count', -1) do
      delete :destroy, :id => @<%= singular_name %>.to_param
    end

    assert_redirected_to admin_<%= plural_name %>_path
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
flexi_generators-0.2.10 lib/generators/flexi/scaffold/templates/tests/controller.rb
flexi_generators-0.2.8 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.6 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.5 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.4 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.3 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.2 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.1 lib/generators/flexi_scaffold/templates/tests/controller.rb
flexi_generators-0.2.0 lib/generators/flexi_scaffold/templates/tests/controller.rb