Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stop using the old shared example API

  • Loading branch information...
commit d13d9b739d5c0371f11544363dea9f62d9ca2165 1 parent 76b9667
@dchelimsky dchelimsky authored
Showing with 13 additions and 20 deletions.
  1. +13 −20 spec/rspec/matchers/have_spec.rb
View
33 spec/rspec/matchers/have_spec.rb
@@ -1,15 +1,8 @@
require 'spec_helper'
require 'stringio'
-share_as :HaveSpecHelper do
- def create_collection_owner_with(n)
- owner = RSpec::Expectations::Helper::CollectionOwner.new
- (1..n).each do |number|
- owner.add_to_collection_with_length_method(number)
- owner.add_to_collection_with_size_method(number)
- end
- owner
- end
+describe "have matcher" do
+
before(:each) do
if defined?(::ActiveSupport::Inflector)
@active_support_was_defined = true
@@ -24,10 +17,17 @@ def self.pluralize(string)
end
end
end
-end
+
+ def create_collection_owner_with(n)
+ owner = RSpec::Expectations::Helper::CollectionOwner.new
+ (1..n).each do |number|
+ owner.add_to_collection_with_length_method(number)
+ owner.add_to_collection_with_size_method(number)
+ end
+ owner
+ end
describe "should have(n).items" do
- include HaveSpecHelper
it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
@@ -63,7 +63,6 @@ def self.pluralize(string)
end
describe 'should have(1).item when ActiveSupport::Inflector is defined' do
- include HaveSpecHelper
it 'pluralizes the collection name' do
owner = create_collection_owner_with(1)
@@ -78,7 +77,6 @@ def self.pluralize(string)
end
describe 'should have(1).item when Inflector is defined' do
- include HaveSpecHelper
before(:each) do
if defined?(Inflector)
@@ -119,7 +117,6 @@ def items
end
describe "should_not have(n).items" do
- include HaveSpecHelper
it "passes if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
@@ -145,7 +142,6 @@ def items
end
describe "should have_exactly(n).items" do
- include HaveSpecHelper
it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
@@ -181,7 +177,6 @@ def items
end
describe "should have_at_least(n).items" do
- include HaveSpecHelper
it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
@@ -235,8 +230,6 @@ def items
end
describe "should have_at_most(n).items" do
- include HaveSpecHelper
-
it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
owner.should have_at_most(3).items_in_collection_with_length_method
@@ -330,8 +323,6 @@ def items
end
describe RSpec::Matchers::Have, "for a collection owner that implements #send" do
- include HaveSpecHelper
-
before(:each) do
@collection = Object.new
def @collection.floozles; [1,2] end
@@ -406,3 +397,5 @@ module Matchers
end
end
end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.