Skip to content

Instantly share code, notes, and snippets.

@krisleech
Created May 11, 2012 08:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisleech/2658418 to your computer and use it in GitHub Desktop.
Save krisleech/2658418 to your computer and use it in GitHub Desktop.
selective paper_trail in RSpec
# 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
# 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
@dennismonsewicz
Copy link

Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment