aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec/lib/spec/expectations
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins/rspec/lib/spec/expectations')
-rw-r--r--vendor/plugins/rspec/lib/spec/expectations/errors.rb12
-rw-r--r--vendor/plugins/rspec/lib/spec/expectations/extensions.rb1
-rw-r--r--vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb52
-rw-r--r--vendor/plugins/rspec/lib/spec/expectations/fail_with.rb45
-rw-r--r--vendor/plugins/rspec/lib/spec/expectations/handler.rb50
5 files changed, 0 insertions, 160 deletions
diff --git a/vendor/plugins/rspec/lib/spec/expectations/errors.rb b/vendor/plugins/rspec/lib/spec/expectations/errors.rb
deleted file mode 100644
index 1fabd105d..000000000
--- a/vendor/plugins/rspec/lib/spec/expectations/errors.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-module Spec
- module Expectations
- # If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
- # will report unmet RSpec expectations as failures rather than errors.
- superclass = ['Test::Unit::AssertionFailedError', '::StandardError'].map do |c|
- eval(c) rescue nil
- end.compact.first
-
- class ExpectationNotMetError < superclass
- end
- end
-end
diff --git a/vendor/plugins/rspec/lib/spec/expectations/extensions.rb b/vendor/plugins/rspec/lib/spec/expectations/extensions.rb
deleted file mode 100644
index d68212e42..000000000
--- a/vendor/plugins/rspec/lib/spec/expectations/extensions.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'spec/expectations/extensions/kernel'
diff --git a/vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb b/vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb
deleted file mode 100644
index 7d8849226..000000000
--- a/vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-module Kernel
- # :call-seq:
- # should(matcher)
- # should == expected
- # should === expected
- # should =~ expected
- #
- # receiver.should(matcher)
- # => Passes if matcher.matches?(receiver)
- #
- # receiver.should == expected #any value
- # => Passes if (receiver == expected)
- #
- # receiver.should === expected #any value
- # => Passes if (receiver === expected)
- #
- # receiver.should =~ regexp
- # => Passes if (receiver =~ regexp)
- #
- # See Spec::Matchers for more information about matchers
- #
- # == Warning
- #
- # NOTE that this does NOT support receiver.should != expected.
- # Instead, use receiver.should_not == expected
- def should(matcher=nil, message=nil, &block)
- Spec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
- end
-
- # :call-seq:
- # should_not(matcher)
- # should_not == expected
- # should_not === expected
- # should_not =~ expected
- #
- # receiver.should_not(matcher)
- # => Passes unless matcher.matches?(receiver)
- #
- # receiver.should_not == expected
- # => Passes unless (receiver == expected)
- #
- # receiver.should_not === expected
- # => Passes unless (receiver === expected)
- #
- # receiver.should_not =~ regexp
- # => Passes unless (receiver =~ regexp)
- #
- # See Spec::Matchers for more information about matchers
- def should_not(matcher=nil, message=nil, &block)
- Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
- end
-end
diff --git a/vendor/plugins/rspec/lib/spec/expectations/fail_with.rb b/vendor/plugins/rspec/lib/spec/expectations/fail_with.rb
deleted file mode 100644
index 5e01f99df..000000000
--- a/vendor/plugins/rspec/lib/spec/expectations/fail_with.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-module Spec
- 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 message.nil?
- raise ArgumentError, "Failure message is nil. Does your matcher define the " +
- "appropriate failure_message_for_* method to return a string?"
- end
- if (Array === message) & (message.length == 3)
- ::Spec.warn(<<-NOTICE
-
-*****************************************************************
-DEPRECATION WARNING: you are using deprecated behaviour that will
-be removed from a future version of RSpec.
-
-* Support for matchers that return arrays from failure message
-methods is deprecated.
-* Instead, the matcher should return a string, and expose methods
-for the expected() and actual() values.
-*****************************************************************
-NOTICE
- )
- message, expected, target = message[0], message[1], message[2]
- end
- unless (differ.nil? || expected.nil? || target.nil?)
- if expected.is_a?(String)
- message << "\n\n Diff:" << self.differ.diff_as_string(target.to_s, expected)
- elsif expected.is_a?(Hash) && target.is_a?(Hash)
- message << "\n\n Diff:" << self.differ.diff_as_hash(target, expected)
- elsif !target.is_a?(Proc)
- message << "\n\n Diff:" << self.differ.diff_as_object(target, expected)
- end
- end
- Kernel::raise(Spec::Expectations::ExpectationNotMetError.new(message))
- end
- end
- end
-end \ No newline at end of file
diff --git a/vendor/plugins/rspec/lib/spec/expectations/handler.rb b/vendor/plugins/rspec/lib/spec/expectations/handler.rb
deleted file mode 100644
index c059637c7..000000000
--- a/vendor/plugins/rspec/lib/spec/expectations/handler.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-module Spec
- module Expectations
- class InvalidMatcherError < ArgumentError; end
-
- class PositiveExpectationHandler
- def self.handle_matcher(actual, matcher, message=nil, &block)
- ::Spec::Matchers.last_should = :should
- ::Spec::Matchers.last_matcher = matcher
- return ::Spec::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil?
-
- match = matcher.matches?(actual, &block)
- return match if match
-
- message ||= matcher.respond_to?(:failure_message_for_should) ?
- matcher.failure_message_for_should :
- matcher.failure_message
-
- if matcher.respond_to?(:diffable?) && matcher.diffable?
- ::Spec::Expectations.fail_with message, matcher.expected.first, matcher.actual
- else
- ::Spec::Expectations.fail_with message
- end
- end
- end
-
- class NegativeExpectationHandler
- def self.handle_matcher(actual, matcher, message=nil, &block)
- ::Spec::Matchers.last_should = :should_not
- ::Spec::Matchers.last_matcher = matcher
- return ::Spec::Matchers::NegativeOperatorMatcher.new(actual) if matcher.nil?
-
- match = matcher.respond_to?(:does_not_match?) ?
- !matcher.does_not_match?(actual, &block) :
- matcher.matches?(actual, &block)
- return match unless match
-
- message ||= matcher.respond_to?(:failure_message_for_should_not) ?
- matcher.failure_message_for_should_not :
- matcher.negative_failure_message
-
- if matcher.respond_to?(:diffable?) && matcher.diffable?
- ::Spec::Expectations.fail_with message, matcher.expected.first, matcher.actual
- else
- ::Spec::Expectations.fail_with message
- end
- end
- end
- end
-end
-