summaryrefslogtreecommitdiff
path: root/spec/lib/google_api
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-10-06 16:14:14 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-10-06 16:14:14 +0200
commitf9d490dbb910cdd05ca0a0fa38331708181e4b1e (patch)
tree0329bd87db08ee068d816646adfd48f8b623d608 /spec/lib/google_api
parent3e26b0dcd113ade77dc8304137c6733cab4c8718 (diff)
downloadgitlab-ce-f9d490dbb910cdd05ca0a0fa38331708181e4b1e.tar.gz
Improve redirect uri state and fix all remaining tests
Diffstat (limited to 'spec/lib/google_api')
-rw-r--r--spec/lib/google_api/cloud_platform/client_spec.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/spec/lib/google_api/cloud_platform/client_spec.rb b/spec/lib/google_api/cloud_platform/client_spec.rb
index e770f2e9edc..acc5bd1da35 100644
--- a/spec/lib/google_api/cloud_platform/client_spec.rb
+++ b/spec/lib/google_api/cloud_platform/client_spec.rb
@@ -4,26 +4,20 @@ describe GoogleApi::CloudPlatform::Client do
let(:token) { 'token' }
let(:client) { described_class.new(token, nil) }
- describe '.session_key_for_second_redirect_uri' do
- subject { described_class.session_key_for_second_redirect_uri(secure: secure) }
+ describe '.session_key_for_redirect_uri' do
+ let(:state) { 'random_string' }
- context 'when pass a postfix' do
- let(:secure) { SecureRandom.hex }
+ subject { described_class.session_key_for_redirect_uri(state) }
- it 'creates a required session key' do
- key, _ = described_class.session_key_for_second_redirect_uri(secure: secure)
- expect(key).to eq("cloud_platform_second_redirect_uri_#{secure}")
- end
+ it 'creates a new session key' do
+ is_expected.to eq('cloud_platform_second_redirect_uri_random_string')
end
+ end
- context 'when pass a postfix' do
- let(:secure) { nil }
-
- it 'creates a new session key' do
- key, secure = described_class.session_key_for_second_redirect_uri
- expect(key).to include('cloud_platform_second_redirect_uri_')
- expect(secure).not_to be_nil
- end
+ describe '.new_session_key_for_redirect_uri' do
+ it 'generates a new session key' do
+ expect { |b| described_class.new_session_key_for_redirect_uri(&b) }
+ .to yield_with_args(String)
end
end