1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/core/connection_tests.rb

36 lines
1.1 KiB
Ruby

Shindo.tests('Fog::Core::Connection', ['core']) do
raises(ArgumentError, "raises ArgumentError when no arguments given") do
Fog::Core::Connection.new
end
tests('new("http://example.com")') do
@instance = Fog::Core::Connection.new("http://example.com")
responds_to([:request, :reset])
tests('user agent').returns("fog/#{Fog::VERSION}") do
@instance.instance_variable_get(:@excon).data[:headers]['User-Agent']
end
end
tests('new("http://example.com", false, options")') do
options = {
:headers => {'User-Agent' => 'custom agent'}
}
@instance = Fog::Core::Connection.new("http://example.com", true, options)
tests('user agent').returns('custom agent') do
@instance.instance_variable_get(:@excon).data[:headers]['User-Agent']
end
end
tests('new("http://example.com", true)') do
Fog::Core::Connection.new("http://example.com", true)
end
tests('new("http://example.com", false, options")') do
options = {
:debug_response => false
}
Fog::Core::Connection.new("http://example.com", true, options)
end
end