Sha256: 852652b596a1583d3e82a111c9a4e993f12431ac701f0644ad3ee153b05d8b2f

Contents?: true

Size: 947 Bytes

Versions: 9

Compression:

Stored size: 947 Bytes

Contents

require "rspec/core"
require "rspec/matchers"
require "paper_trail/frameworks/rspec/helpers"

RSpec.configure do |config|
  config.include ::PaperTrail::RSpec::Helpers::InstanceMethods
  config.extend ::PaperTrail::RSpec::Helpers::ClassMethods

  config.before(:each) do
    ::PaperTrail.enabled = false
    ::PaperTrail.enabled_for_controller = true
    ::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.is_a?(::PaperTrail::Model::InstanceMethods) }
end

RSpec::Matchers.define :have_a_version_with do |attributes|
  # check if the model has a version with the specified attributes
  match { |actual| actual.versions.where_object(attributes).any? }
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paper_trail-5.2.3/lib/paper_trail/frameworks/rspec.rb
paper_trail-5.2.3 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.2.2 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.2.1 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.2.0 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.1.1 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.1.0 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.0.1 lib/paper_trail/frameworks/rspec.rb
paper_trail-5.0.0 lib/paper_trail/frameworks/rspec.rb