Sha256: 272516bfd11d5141a506797480985c9fed0c88c6a119908918739cf45aa67898

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe "PaperTrail RSpec Helper" do
  describe :enabled do
    context 'default' do
      it 'should have versioning off by default' do
        ::PaperTrail.should_not be_enabled
      end
      it 'should turn versioning on in a with_versioning block' do
        ::PaperTrail.should_not be_enabled
        with_versioning do
          ::PaperTrail.should be_enabled
        end
        ::PaperTrail.should_not be_enabled
      end
    end

    context 'versioning: true', :versioning => true do
      it 'should have versioning on by default' do
        ::PaperTrail.should be_enabled
      end
      it 'should keep versioning on after a with_versioning block' do
        ::PaperTrail.should be_enabled
        with_versioning do
          ::PaperTrail.should be_enabled
        end
        ::PaperTrail.should be_enabled
      end
    end
  end

  describe :whodunnit do
    before(:all) { ::PaperTrail.whodunnit = 'foobar' }

    it "should get set to `nil` by default" do
      ::PaperTrail.whodunnit.should be_nil
    end
  end

  describe :controller_info do
    before(:all) { ::PaperTrail.controller_info = {:foo => 'bar'} }

    it "should get set to an empty hash before each test" do
      ::PaperTrail.controller_info.should == {}
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
paper_trail_without_deprecated-3.0.0.beta1 spec/paper_trail_spec.rb
paper_trail-3.0.0.beta1 spec/paper_trail_spec.rb