Skip to content

Commit

Permalink
Fix specs that use certificates and private keys
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tjarratt committed May 24, 2015
1 parent b5b6e47 commit f2c9ff2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions spec/savon/builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
2 changes: 1 addition & 1 deletion spec/savon/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def to_s
expect(request).to include("<wsse:Username>#{username}</wsse:Username>")

# the nonce node
expect(request).to match(/<wsse:Nonce.*>.+\n<\/wsse:Nonce>/)
expect(request).to match(/<wsse:Nonce.*>.+\n?<\/wsse:Nonce>/)

# the created node with a timestamp
expect(request).to match(/<wsu:Created>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.*<\/wsu:Created>/)
Expand Down

0 comments on commit f2c9ff2

Please sign in to comment.