summaryrefslogtreecommitdiff
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-23 10:43:47 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-23 10:43:47 +0100
commit718ea942dc1b2ef749bf852a19a86f0928e4b36d (patch)
tree2b73213ccd61fad53fa0c9ee224d6a579ab96837 /spec/models/concerns
parent636b038e01c7064c6d1a88359f0370dbefc323e1 (diff)
downloadgitlab-ce-718ea942dc1b2ef749bf852a19a86f0928e4b36d.tar.gz
Improve test cases description in token-related specs
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/token_authenticatable_strategies/encrypted_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/models/concerns/token_authenticatable_strategies/encrypted_spec.rb b/spec/models/concerns/token_authenticatable_strategies/encrypted_spec.rb
index cbf7bf085ef..4c074470f63 100644
--- a/spec/models/concerns/token_authenticatable_strategies/encrypted_spec.rb
+++ b/spec/models/concerns/token_authenticatable_strategies/encrypted_spec.rb
@@ -14,7 +14,7 @@ describe TokenAuthenticatableStrategies::Encrypted do
end
describe '#find_token_authenticatable' do
- it 'finds a relevant resource by encrypted value' do
+ it 'finds the encrypted resource by cleartext' do
allow(model).to receive(:find_by)
.with('some_field_encrypted' => encrypted)
.and_return('encrypted resource')
@@ -23,8 +23,8 @@ describe TokenAuthenticatableStrategies::Encrypted do
.to eq 'encrypted resource'
end
- it 'uses fallback strategy when token can not be found' do
- allow_any_instance_of(TokenAuthenticatableStrategies::Insecure)
+ it 'uses fallback strategy when encrypted token cannot be found' do
+ allow(subject.send(:fallback_strategy))
.to receive(:find_token_authenticatable)
.and_return('plaintext resource')
@@ -38,7 +38,7 @@ describe TokenAuthenticatableStrategies::Encrypted do
end
describe '#get_token' do
- it 'decrypts a token when encrypted token is present' do
+ it 'returns decrypted token when an encrypted token is present' do
allow(instance).to receive(:read_attribute)
.with('some_field_encrypted')
.and_return(encrypted)
@@ -46,7 +46,7 @@ describe TokenAuthenticatableStrategies::Encrypted do
expect(subject.get_token(instance)).to eq 'my-value'
end
- it 'reads a plaintext token when encrypted token is not present' do
+ it 'returns the plaintext token when encrypted token is not present' do
allow(instance).to receive(:read_attribute)
.with('some_field_encrypted')
.and_return(nil)
@@ -60,7 +60,7 @@ describe TokenAuthenticatableStrategies::Encrypted do
end
describe '#set_token' do
- it 'writes encrypted token to a model instance and returns it' do
+ it 'writes encrypted token and removes plaintext token and returns it' do
expect(instance).to receive(:[]=)
.with('some_field_encrypted', encrypted)
expect(instance).to receive(:[]=)