diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-06 06:02:13 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-07 05:20:17 +0300 |
commit | c4f56a88029c1fe73bf6efb062b5f77a65282fed (patch) | |
tree | 890a869e8ce06a5438b38c8e9dca9529362cc2f4 /app/models | |
parent | a475411f4380ef4d0260940206e2553da3b2f3ee (diff) |
Increase test suite around deploy tokens behavior
Also, fixes broken specs
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/deploy_token.rb | 6 | ||||
-rw-r--r-- | app/models/project_deploy_token.rb | 6 |
2 files changed, 1 insertions, 11 deletions
diff --git a/app/models/deploy_token.rb b/app/models/deploy_token.rb index 6639cb17287..11add42b2c5 100644 --- a/app/models/deploy_token.rb +++ b/app/models/deploy_token.rb @@ -17,10 +17,6 @@ class DeployToken < ActiveRecord::Base scope :read_repository, -> { where(read_repository: true) } scope :read_registry, -> { where(read_registry: true) } - def self.redis_shared_state_key(user_id) - "gitlab:deploy_token:user_#{user_id}" - end - def revoke! update!(revoked: true) end @@ -38,7 +34,7 @@ class DeployToken < ActiveRecord::Base end def has_access_to?(requested_project) - self.projects.first == requested_project + project == requested_project end def project diff --git a/app/models/project_deploy_token.rb b/app/models/project_deploy_token.rb index 2831b01e378..ab4482f0c0b 100644 --- a/app/models/project_deploy_token.rb +++ b/app/models/project_deploy_token.rb @@ -5,10 +5,4 @@ class ProjectDeployToken < ActiveRecord::Base validates :deploy_token, presence: true validates :project, presence: true validates :deploy_token_id, uniqueness: { scope: [:project_id] } - - accepts_nested_attributes_for :deploy_token - - def redis_shared_state_key(user_id) - "gitlab:deploy_token:#{project_id}:#{user_id}" - end end |