Sha256: a2ecca1b18f5b24b1284224efc3740ad385090020ddf8565cb282818928a67aa

Contents?: true

Size: 926 Bytes

Versions: 19

Compression:

Stored size: 926 Bytes

Contents

require 'test_helper'

class EnabledForControllerTest < ActionController::TestCase
  tests ArticlesController

  context "`PaperTrail.enabled? == true`" do
    should 'enabled_for_controller?.should == true' do
      assert PaperTrail.enabled?
      post :create, :article => { :title => 'Doh', :content => Faker::Lorem.sentence }
      assert_not_nil assigns(:article)
      assert PaperTrail.enabled_for_controller?
      assert_equal 1, assigns(:article).versions.length
    end
  end

  context "`PaperTrail.enabled? == false`" do
    setup { PaperTrail.enabled = false }
    
    should 'enabled_for_controller?.should == false' do
      assert !PaperTrail.enabled?
      post :create, :article => { :title => 'Doh', :content => Faker::Lorem.sentence }
      assert !PaperTrail.enabled_for_controller?
      assert_equal 0, assigns(:article).versions.length
    end

    teardown { PaperTrail.enabled = true }
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
paper_trail-4.2.0 test/functional/enabled_for_controller_test.rb
paper_trail-4.1.0 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.2 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.1 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.9 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.0 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.0.rc2 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.0.rc1 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.8 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.7 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.0.beta2 test/functional/enabled_for_controller_test.rb
paper_trail-4.0.0.beta1 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.6 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.5 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.2 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.1 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.0 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.0.rc2 test/functional/enabled_for_controller_test.rb
paper_trail-3.0.0.rc1 test/functional/enabled_for_controller_test.rb