Sha256: ac1d70ed2c278e339851440ba2d37adf089d5f1f03f6d3df74825e1b53edfb40

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

module DevelopWithPassion
  module Fakes
    module RSpec
      describe ReceivedCriteria do
        context "when matching a call made without arguments" do
          it "should match if the call was made" do
            item = fake
            item.hello

            sut = ReceivedCriteria.new(item.received(:hello))

            sut.is_satisfied_by.should be_true
          end
        end
        context "when matching a call made with arguments" do
          let(:item){fake}
          before (:each) do
            item.hello("world")
            @sut = ReceivedCriteria.new(item.received(:hello))
          end
          context "and we care about the arguments it was called with" do
            it "should match if it received the correct call" do
              @sut.is_satisfied_by("world").should be_true
            end
            it "should not match if the arguments provided are not in the call history" do
              @sut.is_satisfied_by("yo").should be_false
            end
            
          end
          context "and we don't care about the arguments it was called with" do
            it "should match if it received a call to the method" do
              @sut.is_satisfied_by.should be_true
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
developwithpassion_fakes-rspec-0.0.8 spec/specs/received_criteria_spec.rb
developwithpassion_fakes-rspec-0.0.7 spec/specs/received_criteria_spec.rb
developwithpassion_fakes-rspec-0.0.6 spec/specs/received_criteria_spec.rb
developwithpassion_fakes-rspec-0.0.5 spec/specs/received_criteria_spec.rb