Commit 1a2ff7c

mokha <mokha@cisco.com>
2018-03-05 23:55:24
add spec for decoding a decoded file.
1 parent 560df06
Changed files (3)
spec/saml/kit/cli/commands/decode_spec.rb
@@ -35,4 +35,17 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do
     specify { expect(output).to include("Decoded #{document.send(:name)}") }
     specify { expect(output).to include(document.signature.certificate.x509.to_text) }
   end
+
+  describe "#raw" do
+    let(:command) { "decode raw #{tempfile}" }
+    let(:tempfile) { Tempfile.new('saml-kit').path }
+    let(:document) { Saml::Kit::AuthenticationRequest.build }
+
+    before { IO.write(tempfile, document.to_xml) }
+    after { File.unlink(tempfile) }
+
+    specify { expect(status).to be_success }
+    specify { expect(output).to include(document.to_xml(pretty: true)) }
+    specify { expect(output).to include("Decoded #{document.send(:name)}") }
+  end
 end
spec/saml/kit/cli/commands/metadata_spec.rb
@@ -1,5 +1,3 @@
-require 'tempfile'
-
 RSpec.describe Saml::Kit::Cli::Commands::Metadata do
   let(:entity_id) { 'https://saml-kit-proof.herokuapp.com/metadata' }
 
spec/spec_helper.rb
@@ -1,5 +1,6 @@
 require 'bundler/setup'
 require 'saml/kit/cli'
+require 'tempfile'
 require_relative 'support/shell_helpers.rb'
 
 RSpec.configure do |config|