1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/spec/fog/xml/connection_spec.rb
Paul Thornthwaite 706f873c53 DRY up specs with spec_helper
We require setting up MiniSpec and `fog` in each spec and this just
feels cleaner way of doing it.

Adding Coverage next and we don't want the code in EVERY spec.
2015-03-15 00:47:24 +00:00

33 lines
932 B
Ruby

require "spec_helper"
# @note This is going to be part of fog-xml eventually
describe Fog::XML::Connection do
before do
@connection = Fog::XML::Connection.new("http://localhost")
end
after do
Excon.stubs.clear
end
it "responds to #request" do
assert_respond_to @connection, :request
end
describe "when request is passed a parser" do
it "returns the body after parsing" do
@parser = Fog::ToHashDocument.new
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
response = @connection.request(:parser => @parser, :mock => true)
assert_equal({ :xml => "" }, response.body)
end
end
describe "when request excludes a parser" do
it "returns the response body without change" do
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
response = @connection.request(:mock => true)
assert_equal("<xml></xml>", response.body)
end
end
end