Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / spec / spec_helper.rb
blob6945c89bee5fa6288003b9b9c1ab3e6046bebb2b
1 require 'stringio'
2 require 'rbconfig'
4 dir = File.dirname(__FILE__)
5 lib_path = File.expand_path("#{dir}/../lib")
6 $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
8 require 'spec'
9 require 'spec/mocks'
10 require 'hpricot'
11 spec_classes_path = File.expand_path("#{dir}/../spec/spec/spec_classes")
12 require spec_classes_path unless $LOAD_PATH.include?(spec_classes_path)
14 module Spec
15   module Matchers
16     def fail
17       raise_error(Spec::Expectations::ExpectationNotMetError)
18     end
20     def fail_with(message)
21       raise_error(Spec::Expectations::ExpectationNotMetError, message)
22     end
24     class Pass
25       def matches?(proc, &block)
26         begin
27           proc.call
28           true
29         rescue => @error
30           false
31         end
32       end
34       def failure_message
35         @error.message + "\n" + @error.backtrace.join("\n")
36       end
37     end
39     def pass
40       Pass.new
41     end
42   end
43 end