Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/admin/admin_groups_spec.rb')
-rw-r--r--spec/features/admin/admin_groups_spec.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb
index 2d541a34f62..f903d7c2db2 100644
--- a/spec/features/admin/admin_groups_spec.rb
+++ b/spec/features/admin/admin_groups_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe 'Admin Groups' do
let_it_be(:user) { create :user }
let_it_be(:group) { create :group }
- let_it_be(:current_user) { create(:admin) }
+ let_it_be_with_reload(:current_user) { create(:admin) }
before do
sign_in(current_user)
@@ -231,6 +231,28 @@ RSpec.describe 'Admin Groups' do
it_behaves_like 'adds user into a group' do
let(:user_selector) { user.email }
end
+
+ context 'when membership is set to expire' do
+ it 'renders relative time' do
+ expire_time = Time.current + 2.days
+ current_user.update!(time_display_relative: true)
+ group.add_user(user, Gitlab::Access::REPORTER, expires_at: expire_time)
+
+ visit admin_group_path(group)
+
+ expect(page).to have_content(/Expires in \d day/)
+ end
+
+ it 'renders absolute time' do
+ expire_time = Time.current.tomorrow.middle_of_day
+ current_user.update!(time_display_relative: false)
+ group.add_user(user, Gitlab::Access::REPORTER, expires_at: expire_time)
+
+ visit admin_group_path(group)
+
+ expect(page).to have_content("Expires on #{expire_time.strftime('%b %-d')}")
+ end
+ end
end
describe 'add admin himself to a group' do