Sha256: a02879e4fce3f372cd5e86e599bd6c84b15c862539402c1b0b12e736b7586e74

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")

describe Smoke::Request do
  before do
    @url = "http://fake.tld/canned/"
    @web_search = File.join(SPEC_DIR, 'supports', 'slashdot.xml')
    FakeWeb.register_uri(@url, :file => @web_search)
    @request = Smoke::Request.new(@url)
  end
  
  it "should return a Request object" do
    @request.should be_an_instance_of(Smoke::Request)
  end
  
  it "should have a response body" do
    @request.body.should == File.read(@web_search)
  end
  
  it "should have a content type" do
    @request.content_type.should == 'application/octet-stream'
  end
  
  it "should be a pure ruby array response" do
    # Temporary real request, fakeweb isn't allowing content_type setting as of writing
    @request = Smoke::Request.new("http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20search.web%20WHERE%20query%20=%20'ruby'&format=xml")
    @request.body.should be_an_instance_of(Hash)
  end
  
  it "should be a raw string response" do
    @request = Smoke::Request.new(@url, :raw_response)
    @request.body.should be_an_instance_of(String)
  end
  
  describe "http redirects" do
    it "should follow a redirect to a resource"
    it "should follow only one html redirect before raising an error"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
benschwarz-smoke-0.2.3 spec/smoke/request_spec.rb
benschwarz-smoke-0.2.4 spec/smoke/request_spec.rb
benschwarz-smoke-0.3.4 spec/smoke/request_spec.rb
benschwarz-smoke-0.3.5 spec/smoke/request_spec.rb
benschwarz-smoke-0.3.6 spec/smoke/request_spec.rb