summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-11 13:37:54 +0000
committerGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-11 14:39:51 +0100
commit917effb7379f8e871dbc113d7c7dab89473d4bc8 (patch)
treebbb2f322bb44fe524d02c846d3b17f34f3c983a2 /spec
parent28ad40d9740076677420612443358c2976fe0916 (diff)
downloadgitlab-ce-917effb7379f8e871dbc113d7c7dab89473d4bc8.tar.gz
Make sure that token `ensure_*` method always returns a token
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/token_authenticatable_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/models/concerns/token_authenticatable_spec.rb b/spec/models/concerns/token_authenticatable_spec.rb
index 1b553173415..a9b0b64e5de 100644
--- a/spec/models/concerns/token_authenticatable_spec.rb
+++ b/spec/models/concerns/token_authenticatable_spec.rb
@@ -13,7 +13,7 @@ describe User, 'TokenAuthenticatable' do
let(:token_field) { :authentication_token }
it_behaves_like 'TokenAuthenticatable'
- describe 'ensured authentication token' do
+ describe 'ensures authentication token' do
subject { create(:user).send(token_field) }
it { is_expected.to be_a String }
end
@@ -29,6 +29,13 @@ describe ApplicationSetting, 'TokenAuthenticatable' do
context 'token is not generated yet' do
it { expect(token).to be nil }
+
+ describe 'ensured token' do
+ subject { described_class.new.send("ensure_#{token_field}") }
+
+ it { is_expected.to be_a String }
+ it { is_expected.to_not be_blank }
+ end
end
context 'token is generated' do