diff options
Diffstat (limited to 'spec/support/shared_examples/features/deploy_token_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/deploy_token_shared_examples.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/support/shared_examples/features/deploy_token_shared_examples.rb b/spec/support/shared_examples/features/deploy_token_shared_examples.rb index fd77297a490..e70f9b52c09 100644 --- a/spec/support/shared_examples/features/deploy_token_shared_examples.rb +++ b/spec/support/shared_examples/features/deploy_token_shared_examples.rb @@ -1,15 +1,22 @@ # frozen_string_literal: true RSpec.shared_examples 'a deploy token in settings' do - it 'view deploy tokens' do + it 'view deploy tokens', :js do + user.update!(time_display_relative: true) + + visit page_path + within('.deploy-tokens') do expect(page).to have_content(deploy_token.name) expect(page).to have_content('read_repository') expect(page).to have_content('read_registry') + expect(page).to have_content('in 4 days') end end it 'add a new deploy token' do + visit page_path + fill_in 'deploy_token_name', with: 'new_deploy_key' fill_in 'deploy_token_expires_at', with: (Date.today + 1.month).to_s fill_in 'deploy_token_username', with: 'deployer' @@ -24,4 +31,18 @@ RSpec.shared_examples 'a deploy token in settings' do expect(page).to have_selector("input[name='deploy-token'][readonly='readonly']") end end + + context 'when User#time_display_relative is false', :js do + before do + user.update!(time_display_relative: false) + end + + it 'shows absolute times for expires_at' do + visit page_path + + within('.deploy-tokens') do + expect(page).to have_content(deploy_token.expires_at.strftime('%b %d')) + end + end + end end |