3 dir = File.dirname(__FILE__)
4 lib_path = File.expand_path("#{dir}/../lib")
5 $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
6 $_spec_spec = true # Prevents Kernel.exit in various places
11 spec_classes_path = File.expand_path("#{dir}/../spec/spec/spec_classes")
12 require spec_classes_path unless $LOAD_PATH.include?(spec_classes_path)
13 require File.dirname(__FILE__) + '/../lib/spec/expectations/differs/default'
18 raise_error(Spec::Expectations::ExpectationNotMetError)
21 def fail_with(message)
22 raise_error(Spec::Expectations::ExpectationNotMetError, message)
26 def matches?(proc, &block)
30 rescue Exception => @error
36 @error.message + "\n" + @error.backtrace.join("\n")
44 class CorrectlyOrderedMockExpectation
45 def initialize(&event)
49 def expect(&expectations)
56 CorrectlyOrderedMockExpectation.new(&block)
61 class NonStandardError < Exception; end
64 class ExampleGroupRunner
65 attr_reader :options, :arg
66 def initialize(options, arg)
67 @options, @arg = options, arg
78 def exception_from(&block)
82 rescue StandardError => e
88 describe "sandboxed rspec_options", :shared => true do
92 @original_rspec_options = $rspec_options
96 @options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
97 $rspec_options = options
101 $rspec_options = @original_rspec_options