Sha256: 650bbc5d3bdf5325d073abed956f7834d07998284d789e3abf54e372b86d5b05

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

if defined? RSpec
  require 'rspec/core'
  require 'rspec/matchers'
  require File.expand_path('../rspec/extensions', __FILE__)

  RSpec.configure do |config|
    config.include ::PaperTrail::RSpec::Extensions

    config.before(:each) do
      ::PaperTrail.enabled = false
      ::PaperTrail.whodunnit = nil
      ::PaperTrail.controller_info = {} if defined?(::Rails) && defined?(::RSpec::Rails)
    end

    config.before(:each, :versioning => true) do
      ::PaperTrail.enabled = true
    end
  end

  RSpec::Matchers.define :be_versioned do
    # check to see if the model has `has_paper_trail` declared on it
    match { |actual| actual.kind_of?(::PaperTrail::Model::InstanceMethods) }
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
paper_trail_without_deprecated-3.0.0.beta1 lib/paper_trail/frameworks/rspec.rb
paper_trail-3.0.0.beta1 lib/paper_trail/frameworks/rspec.rb