diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-20 10:05:16 -0500 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-20 12:18:41 -0500 |
commit | cdac54e2a2abe4b93bd5a96603b9d6d8745d277e (patch) | |
tree | 458a5b8eddfbe8cf3bde2771460eaefa7dd7ff07 /spec/models/deploy_token_spec.rb | |
parent | 800ee75aa5f65fc41f32c8d7f3519256cd37c645 (diff) | |
download | gitlab-ce-cdac54e2a2abe4b93bd5a96603b9d6d8745d277e.tar.gz |
Refactor deploy token methods on Ci::Build
Also include a class method for retriving the gitlab_deploy_token on
DeployTokens
Diffstat (limited to 'spec/models/deploy_token_spec.rb')
-rw-r--r-- | spec/models/deploy_token_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/deploy_token_spec.rb b/spec/models/deploy_token_spec.rb index 780b200e837..f8d51a95833 100644 --- a/spec/models/deploy_token_spec.rb +++ b/spec/models/deploy_token_spec.rb @@ -142,4 +142,23 @@ describe DeployToken do end end end + + describe '.gitlab_deploy_token' do + let(:project) { create(:project ) } + + subject { project.deploy_tokens.gitlab_deploy_token } + + context 'with a gitlab deploy token associated' do + it 'should return the gitlab deploy token' do + deploy_token = create(:deploy_token, :gitlab_deploy_token, projects: [project]) + is_expected.to eq(deploy_token) + end + end + + context 'with no gitlab deploy token associated' do + it 'should return nil' do + is_expected.to be_nil + end + end + end end |