lib/rspec/paper_trail.rb in rspec-paper_trail-0.0.8 vs lib/rspec/paper_trail.rb in rspec-paper_trail-0.0.9

- old
+ new

@@ -1,3 +1,32 @@ +require 'paperclip/matchers' require 'rspec/paper_trail/version' require 'rspec/paper_trail/extensions' +module RSpec + module Rails + class Railtie < ::Rails::Railtie + initializer 'paper_trail.rspec' do + RSpec.configure do |config| + config.include Paperclip::Shoulda::Matchers + config.include Rspec::PaperTrailExtensions + + config.before(:each) do + PaperTrail.enabled = false + PaperTrail.controller_info = {} + PaperTrail.whodunnit = nil + end + + config.before(:each, versioning: true) do + PaperTrail.enabled = true + end + end + + RSpec::Matchers.define :be_versioned do + match do |actual| + actual.respond_to?(:versions) + end + end + end + end + end +end