From f2c9ff2adfcbb88e14b2ace3f9de6cea8620ac4f Mon Sep 17 00:00:00 2001 From: Tim Jarratt Date: Tue, 19 May 2015 23:20:06 -0700 Subject: [PATCH] Fix specs that use certificates and private keys At some point recently, something changed on Travis-CI such that the specs can no longer read these files using a relative file path. Changing these to use the absolute path works fabulously. The wsse spec may or may not have a newline at the end of the wsse nonce node, depending on the ruby version and (probably) the version of some gems. --- spec/savon/builder_spec.rb | 17 +++++++++++++---- spec/savon/options_spec.rb | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/spec/savon/builder_spec.rb b/spec/savon/builder_spec.rb index 215f1b15..dc21e2d3 100644 --- a/spec/savon/builder_spec.rb +++ b/spec/savon/builder_spec.rb @@ -83,10 +83,19 @@ end describe "#wsse_signature" do - let(:private_key) { "spec/fixtures/ssl/client_key.pem" } - let(:cert) { "spec/fixtures/ssl/client_cert.pem" } - let(:signature) { Akami::WSSE::Signature.new(Akami::WSSE::Certs.new(:cert_file => cert, :private_key_file => private_key))} - let(:globals) { Savon::GlobalOptions.new(wsse_signature: signature) } + fixture_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'ssl') + + let(:cert) { File.join(fixture_dir, 'client_cert.pem') } + let(:private_key) { File.join(fixture_dir, 'client_key.pem') } + let(:signature) do + Akami::WSSE::Signature.new( + Akami::WSSE::Certs.new( + :cert_file => cert, + :private_key_file => private_key + ) + ) + end + let(:globals) { Savon::GlobalOptions.new(wsse_signature: signature) } subject(:signed_message_nn) {Nokogiri::XML(builder.to_s).remove_namespaces!} subject(:signed_message) {Nokogiri::XML(builder.to_s)} diff --git a/spec/savon/options_spec.rb b/spec/savon/options_spec.rb index 3fb7581f..5d570e46 100644 --- a/spec/savon/options_spec.rb +++ b/spec/savon/options_spec.rb @@ -587,7 +587,7 @@ def to_s expect(request).to include("#{username}") # the nonce node - expect(request).to match(/.+\n<\/wsse:Nonce>/) + expect(request).to match(/.+\n?<\/wsse:Nonce>/) # the created node with a timestamp expect(request).to match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.*<\/wsu:Created>/)