1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00
httparty/spec/web_spec.rb

44 lines
881 B
Ruby
Raw Normal View History

2008-07-27 11:52:18 -04:00
require File.join(File.dirname(__FILE__), 'spec_helper')
class Foo
include Web
base_uri 'api.foo.com/v1'
end
class FooWithHttps
include Web
base_uri 'api.foo.com/v1:443'
end
describe Web do
describe 'base_uri' do
it 'should allow getting' do
Foo.base_uri.should == 'http://api.foo.com/v1'
2008-07-27 11:52:18 -04:00
end
it 'should allow setting' do
Foo.base_uri('api.foobar.com')
Foo.base_uri.should == 'http://api.foobar.com'
2008-07-27 11:52:18 -04:00
end
it 'should set to https if port 443' do
FooWithHttps.base_uri.should == 'https://api.foo.com/v1:443'
2008-07-27 11:52:18 -04:00
end
end
describe 'http' do
it "should use ssl for port 443" do
FooWithHttps.http.use_ssl?.should == true
end
it 'should not use ssl for port 80' do
Foo.base_uri('foobar.com')
Foo.http.use_ssl?.should == false
end
end
describe 'GET' do
end
end