Sha256: fe3f171619d71a28138f153991c68d90f68d7943e951987d44973739c42a9dd9

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

require 'spec/spec_helper'

describe FakeWebMatcher::Extension do
  it "should be included into the FakeWeb::Registry class" do
    FakeWeb::Registry.included_modules.should include(FakeWebMatcher::Extension)
  end
  
  describe '#requests' do
    it "should return an empty Array by default" do
      FakeWeb::Registry.instance.requests.should == []
    end
  end
  
  describe '#clear_requests' do
    it "should clear the requests array" do
      registry = FakeWeb::Registry.instance
      registry.requests << :something
      registry.requests.should == [:something]
      
      registry.clear_requests
      registry.requests.should == []
    end
  end
  
  describe '#response_for' do
    before :each do
      @registry = FakeWeb::Registry.instance
    end
    
    it "should track request" do
      @registry.response_for(:any, 'http://uri.com')
      
      @registry.requests.should == [[:any, 'http://uri.com']]
    end
    
    it "should return the underlying response from response_without_request_tracking" do
      @registry.stub!(:response_without_request_tracking => :response)
      
      @registry.response_for(:any, 'http://uri.com').should == :response
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
freelancing-god-fakeweb-matcher-1.0.1 spec/lib/fake_web_matcher/extension_spec.rb
fakeweb-matcher-1.2.2 spec/lib/fake_web_matcher/extension_spec.rb
fakeweb-matcher-1.2.1 spec/lib/fake_web_matcher/extension_spec.rb
fakeweb-matcher-1.2.0 spec/lib/fake_web_matcher/extension_spec.rb
dnclabs-fakeweb-matcher-1.1.0 spec/lib/fake_web_matcher/extension_spec.rb
fakeweb-matcher-1.1.0 spec/lib/fake_web_matcher/extension_spec.rb
fakeweb-matcher-1.0.1 spec/lib/fake_web_matcher/extension_spec.rb