diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-05-11 16:51:58 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-05-11 16:51:58 +0300 |
commit | 15cdc8bfc833fabd187d2ac9e49ed0c7ce9b9610 (patch) | |
tree | 8e487cd40543af62aa42dc0dbe50b894a2bbec8c /spec/features/groups/members | |
parent | 43f83ba76e8a582845b2aabcc607b350caea112e (diff) | |
parent | 8c2b73dc8c5adf41b94033fe1d0a265524e304c4 (diff) |
Merge branch 'master' into 'bootstrap4'
# Conflicts:
# app/views/groups/group_members/index.html.haml
Diffstat (limited to 'spec/features/groups/members')
-rw-r--r-- | spec/features/groups/members/filter_members_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb new file mode 100644 index 00000000000..5ddb5894624 --- /dev/null +++ b/spec/features/groups/members/filter_members_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +feature 'Groups > Members > Filter members' do + let(:user) { create(:user) } + let(:user_with_2fa) { create(:user, :two_factor_via_otp) } + let(:group) { create(:group) } + + background do + group.add_owner(user) + group.add_master(user_with_2fa) + + sign_in(user) + end + + scenario 'shows all members' do + visit_members_list + + expect(first_member).to include(user.name) + expect(second_member).to include(user_with_2fa.name) + expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: '2FA: Everyone') + end + + scenario 'shows only 2FA members' do + visit_members_list(two_factor: 'enabled') + + expect(first_member).to include(user_with_2fa.name) + expect(members_list.size).to eq(1) + expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: '2FA: Enabled') + end + + scenario 'shows only non 2FA members' do + visit_members_list(two_factor: 'disabled') + + expect(first_member).to include(user.name) + expect(members_list.size).to eq(1) + expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: '2FA: Disabled') + end + + def visit_members_list(options = {}) + visit group_group_members_path(group.to_param, options) + end + + def members_list + page.all('ul.content-list > li') + end + + def first_member + members_list.first.text + end + + def second_member + members_list.last.text + end +end |