test/unit/test_request.rb in lolsoap-0.1.4 vs test/unit/test_request.rb in lolsoap-0.2.0

- old
+ new

@@ -4,32 +4,20 @@ module LolSoap describe Request do let(:envelope) { OpenStruct.new } subject { Request.new(envelope) } - [:header, :body, :soap_namespace, :input_type, :output_type].each do |method| - describe "##{method}" do - let(:envelope) { MiniTest::Mock.new } - - it 'delegates to the envelope' do - ret = Object.new - envelope.expect(method, ret) - subject.send(method).must_equal ret - end - end - end - describe '#url' do it 'returns the envelope endpoint' do envelope.endpoint = 'lol' subject.url.must_equal 'lol' end end describe '#headers' do it 'returns the necessary headers' do - envelope.to_xml = '<lol>' + def envelope.to_xml(options); '<lol>'; end envelope.action = 'http://example.com/LolOutLoud' subject.headers.must_equal({ 'Content-Type' => 'application/soap+xml;charset=UTF-8', 'Content-Length' => '5', @@ -38,11 +26,23 @@ end end describe '#content' do it 'returns the envelope as an xml string' do - envelope.to_xml = '<lol>' + def envelope.to_xml(options); '<lol>'; end subject.content.must_equal '<lol>' + end + end + + describe '#mime' do + it 'is application/soap+xml for SOAP 1.2' do + envelope.soap_version = '1.2' + subject.mime.must_equal 'application/soap+xml' + end + + it 'is text/xml for SOAP 1.1' do + envelope.soap_version = '1.1' + subject.mime.must_equal 'text/xml' end end end end