Permalink
Browse files

Remove the have extension

This functionality was extracted into
rspec/rspec-collection_matchers#5

Fixes #808
  • Loading branch information...
1 parent dd4408a commit 7fd43e9d1ebbd059959745078fbd41370f98e6fa @soulcutter soulcutter committed Aug 19, 2013
@@ -22,6 +22,5 @@ class AssertionFailedError < StandardError
require 'rspec/rails/matchers/routing_matchers'
require 'rspec/rails/matchers/be_new_record'
require 'rspec/rails/matchers/be_a_new'
-require 'rspec/rails/matchers/have_extension'
require 'rspec/rails/matchers/relation_match_array'
require 'rspec/rails/matchers/be_valid'
@@ -1,35 +0,0 @@
-require 'active_support/core_ext/module/aliasing'
-require 'rspec/matchers/built_in/have'
-
-module RSpec::Rails::Matchers
- module HaveExtensions
- extend ActiveSupport::Concern
-
- # @api private
- #
- # Enhances the failure message for `to have(n)` matchers
- def failure_message_for_should_with_errors_on_extensions
- return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@actual}" if @collection_name == :errors_on
- return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@actual}" if @collection_name == :error_on
- return failure_message_for_should_without_errors_on_extensions
- end
-
- # @api private
- #
- # Enhances the description for `to have(n)` matchers
- def description_with_errors_on_extensions
- return "have #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}" if @collection_name == :errors_on
- return "have #{relativities[@relativity]}#{@expected} error on :#{@args[0]}" if @collection_name == :error_on
- return description_without_errors_on_extensions
- end
-
- included do
- alias_method_chain :failure_message_for_should, :errors_on_extensions
- alias_method_chain :description, :errors_on_extensions
- end
- end
-end
-
-RSpec::Matchers::BuiltIn::Have.class_eval do
- include RSpec::Rails::Matchers::HaveExtensions
-end
@@ -1,38 +0,0 @@
-require "spec_helper"
-
-describe "error_on" do
- it "provides a description including the name of what the error is on" do
- have(1).error_on(:whatever).description.should == "have 1 error on :whatever"
- end
-
- it "provides a failure message including the number actually given" do
- lambda {
- [].should have(1).error_on(:whatever)
- }.should raise_error("expected 1 error on :whatever, got 0")
- end
-end
-
-describe "errors_on" do
- it "provides a description including the name of what the error is on" do
- have(2).errors_on(:whatever).description.should == "have 2 errors on :whatever"
- end
-
- it "provides a failure message including the number actually given" do
- lambda {
- [1].should have(3).errors_on(:whatever)
- }.should raise_error("expected 3 errors on :whatever, got 1")
- end
-end
-
-describe "have something other than error_on or errors_on" do
- it "has a standard rspec failure message" do
- lambda {
- [1,2,3].should have(2).elements
- }.should raise_error("expected 2 elements, got 3")
- end
-
- it "has a standard rspec description" do
- have(2).elements.description.should == "have 2 elements"
- end
-end
-

0 comments on commit 7fd43e9

Please sign in to comment.