Sha256: 961289fd96d92990ad8ed16eea3efc6a360b1bd066ecb037aaa607a0eac33c18

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

require 'spec/spec_helper'

describe FakeWebMatcher::Matchers do
  describe '#have_requested' do
    before :each do
      class Matchbox
        include FakeWebMatcher::Matchers
      end
      
      @matcher = Matchbox.new.have_requested(:put, 'http://url.com')
    end
    
    it "should return an instance of RequestMatcher" do
      @matcher.should be_a(FakeWebMatcher::RequestMatcher)
    end
    
    it "should set the url and method using the matcher arguments" do
      @matcher.url.to_s.should  == 'http://url.com'
      @matcher.method.should    == :put
    end
  end
  
  it "should pass if the request has been made" do
    FakeWeb.register_uri(:get, 'http://example.com/', :body => 'foo')
    open('http://example.com/')
    
    FakeWeb.should have_requested(:get, 'http://example.com')
  end
  
  it "should pass if the request has not been made" do
    FakeWeb.register_uri(:get, 'http://example.com/', :body => 'foo')
    
    FakeWeb.should_not have_requested(:get, 'http://example.com')
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
freelancing-god-fakeweb-matcher-1.0.1 spec/lib/fake_web_matcher/matchers_spec.rb
fakeweb-matcher-1.1.0 spec/lib/fake_web_matcher/matchers_spec.rb
fakeweb-matcher-1.0.1 spec/lib/fake_web_matcher/matchers_spec.rb