Sha256: 03989e4204d0f583cf4c7d61e91f32b281234b26c7984502575e1b4350f14fe3

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

class Admin::NoticesControllerTest < ActionController::TestCase
  def test_index
    get :index
    assert_template 'index'
  end

  def test_show
    get :show, :id => Notice.first
    assert_template 'show'
  end

  def test_new
    get :new
    assert_template 'new'
  end

  def test_create_invalid
    Notice.any_instance.stubs(:valid?).returns(false)
    post :create
    assert_template 'new'
  end

  def test_create_valid
    Notice.any_instance.stubs(:valid?).returns(true)
    post :create
    assert_redirected_to admin_notice_url(assigns(:notice))
  end

  def test_edit
    get :edit, :id => Notice.first
    assert_template 'edit'
  end

  def test_update_invalid
    Notice.any_instance.stubs(:valid?).returns(false)
    put :update, :id => Notice.first
    assert_template 'edit'
  end

  def test_update_valid
    Notice.any_instance.stubs(:valid?).returns(true)
    put :update, :id => Notice.first
    assert_redirected_to admin_notice_url(assigns(:notice))
  end

  def test_destroy
    notice = Notice.first
    delete :destroy, :id => notice
    assert_redirected_to admin_notices_url
    assert !Notice.exists?(notice.id)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kit_cms-2.3.22 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.20 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.19 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.18 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.17 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.16 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.15 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.14 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.13 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.11 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.10 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.9 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.8 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.7 test/functional/admin/notices_controller_test.rb
kit_cms-2.3.6 test/functional/admin/notices_controller_test.rb