Sha256: 24d99ed5d6e893872b27d8f328f5b75112b964b120716983b80f00faf3caea47

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

module Fakes
  describe CombinedArgMatcher do
    context "when determining whether it matches an set of arguments" do
      let(:args){[2,3]}
      let(:first_matcher){Object.new}
      let(:second_matcher){Object.new}
      let(:matchers){[first_matcher,second_matcher]}
      let(:options){{:matchers => matchers}}
      let(:sut){CombinedArgMatcher.new(options)}
      before (:each) do
        first_matcher.stub(:matches?).with(2).and_return(3)
        second_matcher.stub(:matches?).with(3).and_return(3)
      end
      
      
      before (:each) do
        @result = sut.matches?(args)
      end
      
      
      it "should match if each of its argument matchers matches its respective argument" do
        expect(@result).to be_true
      end
    end
    context "when adding a matcher" do
      let(:first_matcher){Object.new}
      let(:matchers){[]}
      let(:options){{:matchers => matchers}}
      let(:sut){CombinedArgMatcher.new(options)}
      
      before (:each) do
        sut.add(first_matcher)
      end
      
      
      it "should add the matcher to its set of matchers" do
        expect(matchers[0]).to eql(first_matcher)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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