Sha256: 7066794ec688dbda3f7b7eeffa7b07879b4d8539638fc747ec0d235fd7ac1714

Contents?: true

Size: 1.18 KB

Versions: 16

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fakes-rspec-2.0.0 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.6 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.5 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.4 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.3 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.2 spec/specs/received_criteria_spec.rb
fakes-rspec-1.0.0 spec/specs/received_criteria_spec.rb
fakes-rspec-0.4.1 spec/specs/received_criteria_spec.rb
fakes-rspec-0.4.0 spec/specs/received_criteria_spec.rb
fakes-rspec-0.3.8 spec/specs/received_criteria_spec.rb
fakes-rspec-0.3.2 spec/specs/received_criteria_spec.rb
fakes-rspec-0.3.1 spec/specs/received_criteria_spec.rb
fakes-rspec-0.1.3 spec/specs/received_criteria_spec.rb
fakes-rspec-0.1.2 spec/specs/received_criteria_spec.rb
fakes-rspec-0.1.1 spec/specs/received_criteria_spec.rb
fakes-rspec-0.1.0 spec/specs/received_criteria_spec.rb