diff options
| author | mokha <mokha@cisco.com> | 2018-03-06 09:27:50 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-03-06 09:27:50 -0700 |
| commit | c901211e05f31ead4c9615e35eedf0206adb1388 (patch) | |
| tree | dac8f13da380f273ffd88323969ff0a2d16107a1 | |
| parent | 33298c23a00966a6eb971c39ffc4a073f819322f (diff) | |
auto correct rubocop errors.
| -rw-r--r-- | lib/saml/kit/cli/commands/metadata.rb | 2 | ||||
| -rw-r--r-- | spec/saml/kit/cli/commands/certificate_spec.rb | 10 | ||||
| -rw-r--r-- | spec/saml/kit/cli/commands/decode_spec.rb | 6 | ||||
| -rw-r--r-- | spec/saml/kit/cli/commands/metadata_spec.rb | 18 | ||||
| -rw-r--r-- | spec/saml/kit/cli/commands/xml_digital_signature_spec.rb | 10 | ||||
| -rw-r--r-- | spec/support/shell_helpers.rb | 9 |
6 files changed, 28 insertions, 27 deletions
diff --git a/lib/saml/kit/cli/commands/metadata.rb b/lib/saml/kit/cli/commands/metadata.rb index 6701d70..0e7676b 100644 --- a/lib/saml/kit/cli/commands/metadata.rb +++ b/lib/saml/kit/cli/commands/metadata.rb @@ -11,7 +11,7 @@ module Saml desc 'list', "List each of the registered entityId's" def list if registry.count.zero? - say "Please register metadata using `saml-kit metadata register <url>`" + say 'Please register metadata using `saml-kit metadata register <url>`' end registry.each do |x| say x.entity_id, :green diff --git a/spec/saml/kit/cli/commands/certificate_spec.rb b/spec/saml/kit/cli/commands/certificate_spec.rb index b6d1966..bf7bc03 100644 --- a/spec/saml/kit/cli/commands/certificate_spec.rb +++ b/spec/saml/kit/cli/commands/certificate_spec.rb @@ -1,8 +1,8 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do - describe "keypair" do - let(:passphrase) { "password" } + describe 'keypair' do + let(:passphrase) { 'password' } - describe "generating a pem" do + describe 'generating a pem' do let(:command) { "certificate keypair --passphrase #{passphrase}" } specify { expect(status).to be_success } @@ -15,7 +15,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do specify { expect(output).to include('DEK-Info: AES-256-CBC,') } end - describe "generating env format" do + describe 'generating env format' do let(:command) { "certificate keypair --passphrase #{passphrase} --format env" } specify { expect(status).to be_success } @@ -25,7 +25,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do end end - describe "dump" do + describe 'dump' do let(:command) { "certificate dump '#{base64_certificate}'" } let(:base64_certificate) { x509.to_pem } let(:x509) do diff --git a/spec/saml/kit/cli/commands/decode_spec.rb b/spec/saml/kit/cli/commands/decode_spec.rb index e714d43..b2f6fc5 100644 --- a/spec/saml/kit/cli/commands/decode_spec.rb +++ b/spec/saml/kit/cli/commands/decode_spec.rb @@ -1,5 +1,5 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do - describe "#redirect" do + describe '#redirect' do let(:command) { "decode redirect #{redirect_binding.serialize(builder)[0]}" } let(:document) { builder.build } let(:builder) do @@ -17,7 +17,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do specify { expect(output).not_to include('Signature Value') } end - describe "#post" do + describe '#post' do let(:command) { "decode post #{post_binding.serialize(builder)[1]['SAMLResponse']}" } let(:document) { builder.build } let(:user) { double(name_id_for: SecureRandom.uuid) } @@ -36,7 +36,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do specify { expect(output).to include(document.signature.certificate.x509.to_text) } end - describe "#raw" do + describe '#raw' do let(:command) { "decode raw #{tempfile}" } let(:tempfile) { Tempfile.new('saml-kit').path } let(:document) { Saml::Kit::AuthenticationRequest.build } diff --git a/spec/saml/kit/cli/commands/metadata_spec.rb b/spec/saml/kit/cli/commands/metadata_spec.rb index a654922..c3f7975 100644 --- a/spec/saml/kit/cli/commands/metadata_spec.rb +++ b/spec/saml/kit/cli/commands/metadata_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Metadata do after { File.unlink(tempfile) if File.exist?(tempfile) } - describe "#register" do + describe '#register' do let(:command) { "metadata register #{entity_id}" } specify { expect(status).to be_success } @@ -14,35 +14,35 @@ RSpec.describe Saml::Kit::Cli::Commands::Metadata do specify { expect(output).to match(/opening connection to saml-kit-proof.herokuapp.com:443.../) } end - describe "#show" do + describe '#show' do let(:command) { "metadata show #{entity_id}" } - context "when the entity_id is registered" do + context 'when the entity_id is registered' do before { execute("metadata register #{entity_id}") } specify { expect(status).to be_success } specify { expect(output).to include(entity_id) } end - context "when the entity_id is not registered" do + context 'when the entity_id is not registered' do specify { expect(status).to be_success } specify { expect(output).to include("`#{entity_id}` is not registered") } end end - describe "#list" do - let(:command) { "metadata list" } + describe '#list' do + let(:command) { 'metadata list' } - context "when a metadata is registered" do + context 'when a metadata is registered' do before { execute("metadata register #{entity_id}") } specify { expect(status).to be_success } specify { expect(output).to include(entity_id) } end - context "when zero metadata is registered" do + context 'when zero metadata is registered' do specify { expect(status).to be_success } - specify { expect(output).to include("Please register metadata using `saml-kit metadata register <url>`") } + specify { expect(output).to include('Please register metadata using `saml-kit metadata register <url>`') } end end end diff --git a/spec/saml/kit/cli/commands/xml_digital_signature_spec.rb b/spec/saml/kit/cli/commands/xml_digital_signature_spec.rb index 891f9ad..7145e6c 100644 --- a/spec/saml/kit/cli/commands/xml_digital_signature_spec.rb +++ b/spec/saml/kit/cli/commands/xml_digital_signature_spec.rb @@ -1,8 +1,8 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do - describe "#verify" do + describe '#verify' do let(:command) { "xmldsig verify #{tempfile}" } let(:tempfile) { Tempfile.new('saml-kit').path } - let(:entity_id) { SecureRandom.uuid } + let(:entity_id) { SecureRandom.uuid } let(:configuration) do Saml::Kit::Configuration.new do |config| config.entity_id = entity_id @@ -13,7 +13,7 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do before { IO.write(tempfile, xml) } after { File.unlink(tempfile) } - context "file is valid" do + context 'file is valid' do let(:document) { Saml::Kit::AuthenticationRequest.build(configuration: configuration) } let(:xml) { document.to_xml } @@ -22,12 +22,12 @@ RSpec.describe Saml::Kit::Cli::Commands::Certificate do specify { expect(output).to include("success #{tempfile} is valid") } end - context "file is invalid" do + context 'file is invalid' do let(:document) { Saml::Kit::AuthenticationRequest.build(configuration: configuration) } let(:xml) { document.to_xml.gsub(/#{entity_id}/, 'hacked') } specify { expect(status).to be_success } - specify { expect(output).to include("error Digest value is invalid") } + specify { expect(output).to include('error Digest value is invalid') } end end end diff --git a/spec/support/shell_helpers.rb b/spec/support/shell_helpers.rb index b8a58fb..02c11d0 100644 --- a/spec/support/shell_helpers.rb +++ b/spec/support/shell_helpers.rb @@ -1,17 +1,18 @@ -RSpec.shared_context "shell execution" do +RSpec.shared_context 'shell execution' do subject { execute(command) } + let(:status) { subject[0] } let(:output) { subject[1] } - let(:env) { } + let(:env) {} def execute(command, mute: false, env: self.env) full_command = "#{env} bundle exec ruby ./exe/saml-kit #{command} 2>&1" puts full_command unless mute output = `#{full_command}` - [$?, output] + [$CHILD_STATUS, output] end end RSpec.configure do |config| - config.include_context "shell execution" + config.include_context 'shell execution' end |
