Created
May 11, 2012 08:40
-
-
Save krisleech/2658418 to your computer and use it in GitHub Desktop.
selective paper_trail in RSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/paper_trail.rb | |
RSpec.configure do |config| | |
config.before(:each) do | |
PaperTrail.enabled = false | |
end | |
config.before(:each, :versioning => true) do | |
PaperTrail.enabled = true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/models/study_audit.rb | |
require 'spec_helper' | |
describe StudyAudit, :versioning => true do | |
it 'starts when a new study is created' do | |
study = Factory.create(:study) | |
audit = StudyAudit.new(study) | |
audit.versions.size.should == 1 | |
audit.versions[0].event.should == 'create' | |
end | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing!