Skip to content

Commit

Permalink
Merge pull request #18 from ResultadosDigitais/fixing-rspecs
Browse files Browse the repository at this point in the history
[MKTMUSHIN-947] Fixing session Id rspecs
  • Loading branch information
andrelrg authored Feb 27, 2023
2 parents 711f3f1 + 68dd857 commit 4b56c53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ test/tmp
test/version_tmp
tmp
.DS_Store
.byebug_history
1 change: 1 addition & 0 deletions gooder_data.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "httparty"

spec.add_development_dependency "rspec_junit_formatter"
spec.add_development_dependency "byebug"
spec.add_development_dependency "bundler", "> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
Expand Down
11 changes: 7 additions & 4 deletions spec/lib/gooder_data/session_id_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
allow(GPGME::Crypto).to receive(:new) { @crypto }
allow(@crypto).to receive(:sign) { |content, options| "Signed" }
allow(@crypto).to receive(:encrypt) { |content, options| "Encrypted" }

allow(GooderData::SSO).to receive(:import_key!).and_return(true)
end

context "given the default configuration" do
Expand All @@ -20,12 +22,13 @@
let(:gd_sso_recipient) { GooderData.configuration.good_data_sso_recipient }
let(:gd_sso_public_key_url) { GooderData.configuration.good_data_sso_public_key_url }

before { allow(GPGME::Key).to receive(:find).with(:public, gd_sso_recipient) { [] } }
before do
allow(GooderData::SSO).to receive(:import_key!).and_return(false)
allow(GPGME::Key).to receive(:find).with(:public, gd_sso_recipient) { [] }
end

it "should import the gooddata-sso.pub from gd server" do
expect(GPGME::Key).to receive(:import) do |key|
expect(key.base_uri.to_s).to eq gd_sso_public_key_url
end
expect(GooderData::SSO).to receive(:import_key!).with(gd_sso_public_key_url)
session_id
end
end
Expand Down

0 comments on commit 4b56c53

Please sign in to comment.