diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-06 18:22:08 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-07 05:20:17 +0300 |
commit | 8c276580431a750a3141f2ec57690da844a75ac4 (patch) | |
tree | cf709c12560df21ae8a85e9f661c421bad40af3a | |
parent | 29913816309c6f6387b20c8702bcc8e90ef3a984 (diff) |
Removes deploy tokens presenter
4 files changed, 2 insertions, 37 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index d8592233302..f17056f13e0 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -21,7 +21,7 @@ module Projects def render_show @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user) - @deploy_tokens = DeployTokensPresenter.new(@project.deploy_tokens.active, current_user: current_user, project: project) + @deploy_tokens = @project.deploy_tokens.active define_deploy_token define_protected_refs diff --git a/app/presenters/projects/settings/deploy_tokens_presenter.rb b/app/presenters/projects/settings/deploy_tokens_presenter.rb deleted file mode 100644 index ee82e516bfc..00000000000 --- a/app/presenters/projects/settings/deploy_tokens_presenter.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Projects - module Settings - class DeployTokensPresenter < Gitlab::View::Presenter::Simple - include Enumerable - - presents :deploy_tokens - - def length - deploy_tokens.length - end - - def each - deploy_tokens.each do |deploy_token| - yield deploy_token - end - end - end - end -end diff --git a/app/services/deploy_tokens/create_service.rb b/app/services/deploy_tokens/create_service.rb index e623d94b444..b5989e0bbf1 100644 --- a/app/services/deploy_tokens/create_service.rb +++ b/app/services/deploy_tokens/create_service.rb @@ -12,7 +12,7 @@ module DeployTokens end def expires_at_date - params[:expires_at].present? ? default_expires_at : params[:expires_at] + params[:expires_at].presence || default_expires_at end def default_expires_at diff --git a/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb b/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb deleted file mode 100644 index a416acffe94..00000000000 --- a/spec/presenters/projects/settings/deploy_tokens_presenter_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' - -describe Projects::Settings::DeployTokensPresenter do - let(:user) { create(:user) } - let(:project) { create(:project) } - let!(:project_deploy_tokens) { create_list(:project_deploy_token, 3, project: project) } - let(:deploy_tokens) { project.deploy_tokens } - - subject(:presenter) { described_class.new(deploy_tokens, current_user: user, project: project) } - - describe '#length' do - it 'returns the size of deploy tokens presented' do - expect(presenter.length).to eq(3) - end - end -end |