Sha256: b94c963a693f5b310b5cd01b1b0b7c073e9b3172cf3af2187f33cd433f1aebab

Contents?: true

Size: 1.76 KB

Versions: 10

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'

module Guts
  class NavigationsControllerTest < ActionController::TestCase
    setup do
      @navigation = guts_navigations :test_navigation
      @routes     = Engine.routes
    end

    test 'should get index' do
      get :index
      assert_response :success
      assert_not_nil assigns(:navigations)
    end

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

    test 'should create navigation' do
      assert_difference('Navigation.count') do
        post :create, navigation: { title: 'Nav Test' }
      end

      assert_redirected_to navigations_path
      assert_equal 'Navigation was successfully created.', flash[:notice]
    end
    
    test 'should fail to create navigation and send back to new' do
      post :create, navigation: { title: '' }
      assert_template 'guts/navigations/new'
    end

    test 'should show navigation' do
      get :show, id: @navigation
      assert_response :success
    end

    test 'should get edit' do
      get :edit, id: @navigation
      assert_response :success
    end

    test 'should update navigation' do
      patch :update, id: @navigation, navigation: { title: @navigation.title }
      assert_redirected_to navigations_path
      assert_equal 'Navigation was successfully updated.', flash[:notice]
    end
    
    test 'should fail to update navigation and send back to edit' do
      patch :update, id: @navigation, navigation: { title: '' }
      assert_template 'guts/navigations/edit'
    end

    test 'should destroy navigation' do
      assert_difference('Navigation.count', -1) do
        delete :destroy, id: @navigation
      end

      assert_redirected_to navigations_path
      assert_equal 'Navigation was successfully destroyed.', flash[:notice]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guts-1.3.4 test/controllers/guts/navigations_controller_test.rb
guts-1.3.3 test/controllers/guts/navigations_controller_test.rb
guts-1.3.2 test/controllers/guts/navigations_controller_test.rb
guts-1.3.1 test/controllers/guts/navigations_controller_test.rb
guts-1.3.0 test/controllers/guts/navigations_controller_test.rb
guts-1.2.2 test/controllers/guts/navigations_controller_test.rb
guts-1.2.1 test/controllers/guts/navigations_controller_test.rb
guts-1.2.0 test/controllers/guts/navigations_controller_test.rb
guts-1.1.1 test/controllers/guts/navigations_controller_test.rb
guts-1.1.0 test/controllers/guts/navigations_controller_test.rb