Commit c36353b9 authored by Stan Hu's avatar Stan Hu

Fix broken master in spec/helpers/users_helper_spec.rb

https://gitlab.com/gitlab-org/gitlab/merge_requests/20664 was behind
`master` by over 1200 commits when it was merged, and new tests for
badges were added since then. The merge request introduced a new badge
for EE licenses, but since CE installations don't have a concept of a
license, we just need to ignore these badges for the CE tests.

Closes https://gitlab.com/gitlab-org/gitlab/issues/196560
parent 91b332f5
...@@ -7,6 +7,10 @@ describe UsersHelper do ...@@ -7,6 +7,10 @@ describe UsersHelper do
let(:user) { create(:user) } let(:user) { create(:user) }
def filter_ee_badges(badges)
badges.reject { |badge| badge[:text] == 'Is using seat' }
end
describe '#user_link' do describe '#user_link' do
subject { helper.user_link(user) } subject { helper.user_link(user) }
...@@ -118,7 +122,7 @@ describe UsersHelper do ...@@ -118,7 +122,7 @@ describe UsersHelper do
badges = helper.user_badges_in_admin_section(blocked_user) badges = helper.user_badges_in_admin_section(blocked_user)
expect(badges).to eq([text: "Blocked", variant: "danger"]) expect(filter_ee_badges(badges)).to eq([text: "Blocked", variant: "danger"])
end end
end end
...@@ -128,7 +132,7 @@ describe UsersHelper do ...@@ -128,7 +132,7 @@ describe UsersHelper do
badges = helper.user_badges_in_admin_section(admin_user) badges = helper.user_badges_in_admin_section(admin_user)
expect(badges).to eq([text: "Admin", variant: "success"]) expect(filter_ee_badges(badges)).to eq([text: "Admin", variant: "success"])
end end
end end
...@@ -138,7 +142,7 @@ describe UsersHelper do ...@@ -138,7 +142,7 @@ describe UsersHelper do
badges = helper.user_badges_in_admin_section(external_user) badges = helper.user_badges_in_admin_section(external_user)
expect(badges).to eq([text: "External", variant: "secondary"]) expect(filter_ee_badges(badges)).to eq([text: "External", variant: "secondary"])
end end
end end
...@@ -146,7 +150,7 @@ describe UsersHelper do ...@@ -146,7 +150,7 @@ describe UsersHelper do
it 'returns the "It\'s You" badge' do it 'returns the "It\'s You" badge' do
badges = helper.user_badges_in_admin_section(user) badges = helper.user_badges_in_admin_section(user)
expect(badges).to eq([text: "It's you!", variant: nil]) expect(filter_ee_badges(badges)).to eq([text: "It's you!", variant: nil])
end end
end end
...@@ -170,7 +174,7 @@ describe UsersHelper do ...@@ -170,7 +174,7 @@ describe UsersHelper do
badges = helper.user_badges_in_admin_section(user) badges = helper.user_badges_in_admin_section(user)
expect(badges).to be_empty expect(filter_ee_badges(badges)).to be_empty
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment