Sha256: abb5b483278ea19943b9449548d3b6fb5028b2249391ad4becfdd3d96dbc1dd6

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Curly do
  before do
    @curly = Curly.new
  end
  
  it "should enable cookies when cookiejar is set" do
    @curly.enable_cookies?.should == false
    @curly.cookiejar = 'foo'
    @curly.enable_cookies?.should == true
  end
  
  it "should post params hash" do
    field_arg = an_instance_of(Curl::PostField)
    @curly.should_receive(:http_post).with(field_arg, field_arg)
    @curly.post(:foo => 'bar', :baz => 'foo')
  end
  
  it "should get document" do
    @curly.should_receive(:http_get).with().and_return(true)
    @curly.stub!(:response_code).and_return(200)
    @curly.stub!(:body_str).and_return(<<-HTML)
      <html>
        <body>You are being
          <a href=\"http://localhost:3000/login\">redirected</a>.
        </body>
      </html>
    HTML
    
    doc = @curly.get('http://example.com').doc
    @curly.url.should == 'http://example.com'
    doc.class.should == Hpricot::Doc
    doc.at('a[@href]').inner_text.should == 'redirected'
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
kmayer-highrise-0.11.0 spec/highrise/curly_spec.rb
kmayer-highrise-0.11.1 spec/highrise/curly_spec.rb
kmayer-highrise-0.12.0 spec/highrise/curly_spec.rb
kmayer-highrise-0.13.0 spec/highrise/curly_spec.rb
kmayer-highrise-0.8.0 spec/highrise/curly_spec.rb
kmayer-highrise-0.8.1 spec/highrise/curly_spec.rb
kmayer-highrise-0.9.0 spec/highrise/curly_spec.rb
kmayer-highrise-0.9.1 spec/highrise/curly_spec.rb
kmayer-highrise-0.9.2 spec/highrise/curly_spec.rb
soleone-highrise-0.13.3 spec/highrise/curly_spec.rb