Sha256: 5b9bcc53af2d9d81e039ec790c2d0f9e670e5987681598ae77e771fd15d2c001

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'active_record'
require 'action_controller'
require 'action_mailer'
require 'rspec/rails'

Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

# TODO - most of this is borrowed from rspec-core's spec_helper - should
# be extracted to something we can use here
def in_editor?
  ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
end

class RSpec::Core::ExampleGroup
  def self.run_all(reporter=nil)
    run(reporter || RSpec::Mocks::Mock.new('reporter').as_null_object)
  end
end

module MatchesForRSpecRailsSpecs
  extend RSpec::Matchers::DSL

  matcher :be_included_in_files_in do |path|
    match do |mod|
      stub_metadata(
        :example_group => {:file_path => "#{path}whatever_spec.rb:15"}
      )
      group = RSpec::Core::ExampleGroup.describe
      group.included_modules.include?(mod)
    end
  end
end

RSpec.configure do |c|
  c.include MatchesForRSpecRailsSpecs
  c.color_enabled = !in_editor?
  c.before(:each) do
    @real_world = RSpec.world
    RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
  end
  c.after(:each) do
    RSpec.instance_variable_set(:@world, @real_world)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.20 spec/spec_helper.rb
rspec-rails-2.0.0.beta.19 spec/spec_helper.rb
rspec-rails-2.0.0.beta.18 spec/spec_helper.rb
rspec-rails-2.0.0.beta.17 spec/spec_helper.rb