diff options
author | Francis Irving <francis@mysociety.org> | 2009-12-02 17:56:17 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-12-02 17:56:17 +0000 |
commit | 1bbb3f950f8bee92bf8a39e6f18c3278f1bab11d (patch) | |
tree | 5d0312d5d00446cd1454a5e1c799cd89d57b10d6 /vendor/plugins/rspec/lib/spec/expectations.rb | |
parent | 5f3139b538d1ff58b719a72d7c7cf05a5b6136b5 (diff) |
Changing rspec / rspec_on_rails version
Diffstat (limited to 'vendor/plugins/rspec/lib/spec/expectations.rb')
-rw-r--r-- | vendor/plugins/rspec/lib/spec/expectations.rb | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/vendor/plugins/rspec/lib/spec/expectations.rb b/vendor/plugins/rspec/lib/spec/expectations.rb index 65ea47425..13cf59b26 100644 --- a/vendor/plugins/rspec/lib/spec/expectations.rb +++ b/vendor/plugins/rspec/lib/spec/expectations.rb @@ -1,4 +1,5 @@ require 'spec/matchers' +require 'spec/expectations/fail_with' require 'spec/expectations/errors' require 'spec/expectations/extensions' require 'spec/expectations/handler' @@ -30,27 +31,5 @@ module Spec # RSpec ships with a standard set of useful matchers, and writing your own # matchers is quite simple. See Spec::Matchers for details. module Expectations - class << self - attr_accessor :differ - - # raises a Spec::Expectations::ExpectationNotMetError with message - # - # When a differ has been assigned and fail_with is passed - # <code>expected</code> and <code>target</code>, passes them - # to the differ to append a diff message to the failure message. - def fail_with(message, expected=nil, target=nil) # :nodoc: - if Array === message && message.length == 3 - message, expected, target = message[0], message[1], message[2] - end - unless (differ.nil? || expected.nil? || target.nil?) - if expected.is_a?(String) - message << "\nDiff:" << self.differ.diff_as_string(target.to_s, expected) - elsif !target.is_a?(Proc) - message << "\nDiff:" << self.differ.diff_as_object(target, expected) - end - end - Kernel::raise(Spec::Expectations::ExpectationNotMetError.new(message)) - end - end end end |