Sha256: 10988cdaf43d3b6118bc03e3f92c19047dd83bf41437b23a2208286c2b9f8aef

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require 'pathname'
require 'rspec'
require 'rspec/its'
require 'dm-core/spec/setup'

ENV['ADAPTER'] ||= 'in_memory'

SPEC_ROOT = Pathname(__FILE__).dirname.expand_path
LIB_ROOT  = "#{SPEC_ROOT.parent}/lib".freeze
Pathname.glob("#{LIB_ROOT}/dm-core/spec/**/*.rb".to_s).each { |file| require file }
Pathname.glob("#{SPEC_ROOT}/{lib,support,*/shared}/**/*.rb".to_s).each { |file| require file }

RSpec.configure do |config|
  config.extend(DataMapper::Spec::Adapters::Helpers)
  config.include(DataMapper::Spec::PendingHelpers)
  config.include(DataMapper::Spec::Helpers)

  config.after :all do
    DataMapper::Spec.cleanup_models
  end

  config.after :all do
    # global ivar cleanup
    DataMapper::Spec.remove_ivars(self, instance_variables.reject { |ivar| ivar[0, 2] == '@_' })
  end

  config.after :all do
    # WTF: rspec holds a reference to the last match for some reason.
    # When the object ivars are explicitly removed, this causes weird
    # problems when rspec uses it (!).  Why rspec does this I have no
    # idea because I cannot determine the intention from the code.
    DataMapper::Spec.remove_ivars(RSpec::Matchers.last_matcher, %w(@expected))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sbf-dm-core-1.3.0 spec/spec_helper.rb
sbf-dm-core-1.3.0.beta spec/spec_helper.rb