diff --git a/Rakefile b/Rakefile index 0e63d2ff6..e954d1621 100644 --- a/Rakefile +++ b/Rakefile @@ -51,7 +51,7 @@ task :default => :test task :travis => ['test', 'test:travis', 'coveralls_push_workaround'] Rake::TestTask.new do |t| - t.pattern = File.join("**", "test", "**", "*_test.rb") + t.pattern = File.join("**", "spec", "**", "*_spec.rb") end namespace :test do diff --git a/spec/fog/xml/connection_spec.rb b/spec/fog/xml/connection_spec.rb new file mode 100644 index 000000000..5ce5c15ed --- /dev/null +++ b/spec/fog/xml/connection_spec.rb @@ -0,0 +1,34 @@ +require "minitest/autorun" +require "fog" + +# @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 => "" }) + 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 => "" }) + response = @connection.request(:mock => true) + assert_equal("", response.body) + end + end +end diff --git a/test/fog/xml/connection_test.rb b/test/fog/xml/connection_test.rb deleted file mode 100644 index d3ee79d17..000000000 --- a/test/fog/xml/connection_test.rb +++ /dev/null @@ -1,30 +0,0 @@ -require "minitest/autorun" -require "fog" - -# Note this is going to be part of fog-xml eventually -class Fog::XML::ConnectionTest < Minitest::Test - def setup - @connection = Fog::XML::Connection.new("http://localhost") - end - - def teardown - Excon.stubs.clear - end - - def test_respond_to_request - assert_respond_to @connection, :request - end - - def test_request_with_parser - @parser = Fog::ToHashDocument.new - Excon.stub({}, { :status => 200, :body => "" }) - response = @connection.request(:parser => @parser, :mock => true) - assert_equal({ :xml => "" }, response.body) - end - - def test_request_without_parser - Excon.stub({}, { :status => 200, :body => "" }) - response = @connection.request(:mock => true) - assert_equal("", response.body) - end -end