Skip to content

Commit

Permalink
DRY it up
Browse files Browse the repository at this point in the history
  • Loading branch information
LeipeLeon committed Sep 23, 2021
1 parent 68e3abd commit b3ee73f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions spec/user_identity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
end
let(:signed_jwt) { JWT.encode(jwt, jwk.keypair, 'RS256', kid: jwk.kid) }
let(:exported_private_key) { JWT::JWK::RSA.new(private_key).export.merge({ alg: 'RS256' }) }
let(:apple_body) { [exported_private_key] }

before do
stub_request(:get, 'https://appleid.apple.com/auth/keys')
Expand All @@ -41,7 +42,6 @@

context '#valid?' do
context 'when the parameters of the initilizer are correct' do
let(:apple_body) { [exported_private_key] }
let(:user_identity) { '1234.5678.910' }
let(:uid) { user_identity }

Expand All @@ -55,16 +55,13 @@
JWT::JWK::RSA.new(private_key).export.merge({ alg: 'RS256' })
end

let(:apple_body) { [exported_private_key] }

it 'returns the validated JWT attributes' do
expect(user_identity_service.validate!).to eq(jwt)
end
end
end

context 'when the parameters of the initilizer are not correct' do
let(:apple_body) { [exported_private_key] }
let(:user_identity) { '1234.5678.910' }
let(:uid) { '1234.5678.911' }

Expand Down

0 comments on commit b3ee73f

Please sign in to comment.