Sha256: 942cd0f91355653f780564b25fa56e1d39591f775429e3aa7dcda1e42f2bf669
Contents?: true
Size: 953 Bytes
Versions: 9
Compression:
Stored size: 953 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.kind_of?(::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 & 1 rubygems