diff --git a/spec/models/widget_spec.rb b/spec/models/widget_spec.rb index 4ba6e776..d19ca31f 100644 --- a/spec/models/widget_spec.rb +++ b/spec/models/widget_spec.rb @@ -1,13 +1,23 @@ require 'spec_helper' describe Widget do - it { should be_versioned } + describe '`be_versioned` matcher' do + it { should be_versioned } + end - context 'be_versioned matcher', :versioning => true do - it 'should respond to be_versioned' do - widget = Widget.create :name => 'Bob', :an_integer => 1 - widget.should be_versioned - widget.versions.size.should == 1 + describe "`versioning` option" do + let(:widget) { Widget.create :name => 'Bob', :an_integer => 1 } + + context :enabled, :versioning => true do + it 'should enable versioning for models wrapped within a block' do + widget.versions.size.should == 1 + end + end + + context '`disabled` (default)' do + it 'should not enable versioning for models wrapped within a block not marked to used versioning' do + widget.versions.size.should == 0 + end end end end diff --git a/spec/paper_trail_spec.rb b/spec/paper_trail_spec.rb index 70aa5052..e238fddb 100644 --- a/spec/paper_trail_spec.rb +++ b/spec/paper_trail_spec.rb @@ -1,31 +1,29 @@ 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 + 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 + 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