Sha256: 52a3c55c7f1d67e39f942c6416bf36740d4c823b76181d04e9256658c7d13a84

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

module Fakes
  describe ArgMatchFactory do
    context "when creating an argument matcher" do
      context "and none of the arguments are matchers themselves" do
        before (:each) do
          @result = ArgMatchFactory.create_arg_matcher_using([2,3,4])
        end
        
        it "should create a combined matcher that is composed of regular matchers" do
          expect(@result.all_matchers.count).to eql(3)
          
          @result.all_matchers.each do|matcher|
            expect(matcher.class).to eql(RegularArgMatcher)
          end
        end
      end
      context "and the arguments are matchers themselves" do
        let(:matcher){Object.new}
        before (:each) do
          matcher.stub(:respond_to?).with(:matches?).and_return(true)
        end
        
        before (:each) do
          @result = ArgMatchFactory.create_arg_matcher_using([matcher])
        end
        
        it "should create a combined matcher that only using the matchers provided" do
          expect(@result.all_matchers.count).to eql(1)
          expect(@result.all_matchers[0]).to eql(matcher)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fakes-1.1.6 spec/specs/arg_match_factory_spec.rb
fakes-1.1.5 spec/specs/arg_match_factory_spec.rb