Skip to content

Commit

Permalink
Fix rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwiedemann committed Sep 25, 2023
1 parent a26f227 commit 320da2a
Show file tree
Hide file tree
Showing 27 changed files with 159 additions and 159 deletions.
4 changes: 2 additions & 2 deletions src/api/spec/components/avatar_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end

it 'displays avatar without circle' do
expect(rendered_content).not_to have_selector('img.rounded-circle', count: 1)
expect(rendered_content).not_to have_css('img.rounded-circle', count: 1)
end
end

Expand All @@ -28,7 +28,7 @@
end

it 'displays avatar inside a circle' do
expect(rendered_content).to have_selector('img.rounded-circle', count: 1)
expect(rendered_content).to have_css('img.rounded-circle', count: 1)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
let!(:comment) { travel_to(1.day.ago) { create(:comment_request, commentable: bs_request) } }

it 'shows the comment first, as it is an older timeline item' do
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:first-child', text: 'wrote')
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:first-child', text: '1 day ago')
expect(render_inline(described_class.new(bs_request: bs_request))).to have_css('.timeline-item:first-child', text: 'wrote')
expect(render_inline(described_class.new(bs_request: bs_request))).to have_css('.timeline-item:first-child', text: '1 day ago')
end

it 'shows the history element in the second position, as it is more recent' do
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:last-child', text: 'accepted request')
expect(render_inline(described_class.new(bs_request: bs_request))).to have_css('.timeline-item:last-child', text: 'accepted request')
end
end
14 changes: 7 additions & 7 deletions src/api/spec/components/bs_request_comment_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

it 'displays a comment icon' do
expect(rendered_content).to have_selector('i.fa-comment', count: 1)
expect(rendered_content).to have_css('i.fa-comment', count: 1)
end

it 'displays an avatar' do
Expand Down Expand Up @@ -45,11 +45,11 @@
end

it 'is possible to edit the comment' do
expect(rendered_content).to have_selector('.dropdown-menu', text: 'Edit')
expect(rendered_content).to have_css('.dropdown-menu', text: 'Edit')
end

it 'is possible to remove the comment' do
expect(rendered_content).to have_selector('.dropdown-menu', text: 'Delete')
expect(rendered_content).to have_css('.dropdown-menu', text: 'Delete')
end
end

Expand All @@ -64,11 +64,11 @@
end

it 'is not possible to edit the comment' do
expect(rendered_content).not_to have_selector('.dropdown-menu', text: 'Edit')
expect(rendered_content).not_to have_css('.dropdown-menu', text: 'Edit')
end

it 'is not possible to remove the comment' do
expect(rendered_content).not_to have_selector('.dropdown-menu', text: 'Delete')
expect(rendered_content).not_to have_css('.dropdown-menu', text: 'Delete')
end
end

Expand All @@ -88,8 +88,8 @@
end

it 'displays the comments on level 2 in the 2nd level' do
expect(rendered_content).to have_selector('.timeline-item-comment > .timeline-item-comment', text: "(#{comment_c.user.login})\nwrote")
expect(rendered_content).to have_selector('.timeline-item-comment > .timeline-item-comment > .timeline-item-comment', text: 'Comment C')
expect(rendered_content).to have_css('.timeline-item-comment > .timeline-item-comment', text: "(#{comment_c.user.login})\nwrote")
expect(rendered_content).to have_css('.timeline-item-comment > .timeline-item-comment > .timeline-item-comment', text: 'Comment C')
end

it 'does not display the comments on level 4 in the 4th one' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

it 'displays the element comment' do
expect(rendered_content).to have_selector('.timeline-item-comment', text: element.comment)
expect(rendered_content).to have_css('.timeline-item-comment', text: element.comment)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

it 'renders the maintainers of the package' do
expect(rendered_content).to have_selector('img[title="Bob"]', count: 1)
expect(rendered_content).to have_css('img[title="Bob"]', count: 1)
end
end

Expand All @@ -32,7 +32,7 @@
end

it 'renders the maintainers of the project' do
expect(rendered_content).to have_selector('img[title="Bob"]', count: 1)
expect(rendered_content).to have_css('img[title="Bob"]', count: 1)
end
end

Expand All @@ -42,7 +42,7 @@
end

it 'do not render a maintainer' do
expect(rendered_content).to have_selector('img[title="Bob"]', count: 0)
expect(rendered_content).to have_css('img[title="Bob"]', count: 0)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
)
end

it { expect(rendered_content).to have_selector('.build-result', class: 'border-success') }
it { expect(rendered_content).to have_selector('.build-status i', class: 'fa-check text-success') }
it { expect(rendered_content).to have_selector('.build-status span', text: 'succeeded') }
it { expect(rendered_content).to have_selector('.repository-status i', class: 'fa-lock') }
it { expect(rendered_content).to have_selector('.repository-status span', text: 'blocked') }
it { expect(rendered_content).not_to have_selector("div[data-bs-content*='Details']") }
it { expect(rendered_content).to have_css('.build-result', class: 'border-success') }
it { expect(rendered_content).to have_css('.build-status i', class: 'fa-check text-success') }
it { expect(rendered_content).to have_css('.build-status span', text: 'succeeded') }
it { expect(rendered_content).to have_css('.repository-status i', class: 'fa-lock') }
it { expect(rendered_content).to have_css('.repository-status span', text: 'blocked') }
it { expect(rendered_content).not_to have_css("div[data-bs-content*='Details']") }
end

context 'with excluded but visible result' do
Expand All @@ -39,11 +39,11 @@
)
end

it { expect(rendered_content).to have_selector('.build-result', class: 'border-gray-300') }
it { expect(rendered_content).to have_selector('.build-status i', class: 'fa-xmark text-gray-500') }
it { expect(rendered_content).to have_selector('.build-status span', text: 'excluded') }
it { expect(rendered_content).to have_selector('.repository-status i', class: 'fa-truck') }
it { expect(rendered_content).to have_selector('.repository-status span', text: 'published') }
it { expect(rendered_content).to have_selector("div[data-bs-content*='fake details']") }
it { expect(rendered_content).to have_css('.build-result', class: 'border-gray-300') }
it { expect(rendered_content).to have_css('.build-status i', class: 'fa-xmark text-gray-500') }
it { expect(rendered_content).to have_css('.build-status span', text: 'excluded') }
it { expect(rendered_content).to have_css('.repository-status i', class: 'fa-truck') }
it { expect(rendered_content).to have_css('.repository-status span', text: 'published') }
it { expect(rendered_content).to have_css("div[data-bs-content*='fake details']") }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
let(:build_details) { 'Some details about the build' }

it 'renders a span tag with text-warning style and build status scheduled' do
expect(rendered_content).to have_selector('span.text-warning.toggle-build-info',
id: "id-#{package_name}_#{repository_name}_#{architecture_name}",
text: 'scheduled')
expect(rendered_content).to have_css('span.text-warning.toggle-build-info',
id: "id-#{package_name}_#{repository_name}_#{architecture_name}",
text: 'scheduled')
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

it do
expect(rendered_content).to have_selector(:css, 'a[href="my/notifications?update_all=true"]')
expect(rendered_content).to have_link('my/notifications?update_all=true')
end

it do
Expand All @@ -35,7 +35,7 @@
end

it do
expect(rendered_content).to have_selector(:css, 'a[href="my/notifications?type=read&update_all=true"]')
expect(rendered_content).to have_link('my/notifications?type=read&update_all=true')
end

it do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

it 'renders a div containing only the target project and package names' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'project_123 / package_123')
expect(rendered_content).to have_css('div.smart-overflow', text: 'project_123 / package_123')
end
end

Expand All @@ -29,7 +29,7 @@
end

it 'renders a div containing only the target project' do
expect(rendered_content).to have_selector('div.smart-overflow', exact_text: 'project_12345')
expect(rendered_content).to have_css('div.smart-overflow', exact_text: 'project_12345')
end
end

Expand All @@ -48,7 +48,7 @@
end

it 'renders a div containing the source and target project/package names' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'source_project_123 / source_package_123project_123 / package_123')
expect(rendered_content).to have_css('div.smart-overflow', text: 'source_project_123 / source_package_123project_123 / package_123')
end
end

Expand All @@ -63,7 +63,7 @@
end

it 'renders a div containing only the target project and package names' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'project_123 / package_123')
expect(rendered_content).to have_css('div.smart-overflow', text: 'project_123 / package_123')
end
end

Expand All @@ -79,7 +79,7 @@
end

it 'renders a div containing only the target project and package names' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'project_123 / package_123')
expect(rendered_content).to have_css('div.smart-overflow', text: 'project_123 / package_123')
end
end

Expand All @@ -93,7 +93,7 @@
end

it 'renders a div containing the project name' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'my_project')
expect(rendered_content).to have_css('div.smart-overflow', text: 'my_project')
end
end

Expand All @@ -108,7 +108,7 @@
end

it 'renders a div containing the project and package names' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'my_project_2 / my_package_2')
expect(rendered_content).to have_css('div.smart-overflow', text: 'my_project_2 / my_package_2')
end
end

Expand All @@ -124,7 +124,7 @@
end

it 'renders a div containing who added the recipient and their new role in the project' do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'Jane made you maintainer of some_awesome_project')
expect(rendered_content).to have_css('div.smart-overflow', text: 'Jane made you maintainer of some_awesome_project')
end
end

Expand All @@ -139,7 +139,7 @@
end

it "renders a div containing who added the recipient's group and their new role in the project" do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'Jane made group_1 maintainer of some_awesome_project')
expect(rendered_content).to have_css('div.smart-overflow', text: 'Jane made group_1 maintainer of some_awesome_project')
end
end
end
Expand All @@ -156,7 +156,7 @@
end

it "renders a div containing who removed the recipient's role in the project" do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'Jane removed you as maintainer of some_awesome_project')
expect(rendered_content).to have_css('div.smart-overflow', text: 'Jane removed you as maintainer of some_awesome_project')
end
end

Expand All @@ -171,7 +171,7 @@
end

it "renders a div containing who removed the recipient's group role in the project" do
expect(rendered_content).to have_selector('div.smart-overflow', text: 'Jane removed group_1 as maintainer of some_awesome_project')
expect(rendered_content).to have_css('div.smart-overflow', text: 'Jane removed group_1 as maintainer of some_awesome_project')
end
end
end
Expand All @@ -185,8 +185,8 @@
before { render_inline(described_class.new(notification)) }

it 'renders a div containing who created a report and for what' do
expect(rendered_content).to have_selector('div.smart-overflow',
text: "User '#{notification.notifiable.user.login}' created a report for a Comment for the following reason:Because reasons.")
expect(rendered_content).to have_css('div.smart-overflow',
text: "User '#{notification.notifiable.user.login}' created a report for a Comment for the following reason:Because reasons.")
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions src/api/spec/components/notification_avatars_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
end

it 'renders an extra avatar for other users involved' do
expect(rendered_content).to have_selector('li.list-inline-item > span[title="1 more users involved"]')
expect(rendered_content).to have_css('li.list-inline-item > span[title="1 more users involved"]')
end

it 'renders an avatar for each user up to the limit MAXIMUM_DISPLAYED_AVATARS' do
expect(rendered_content).to have_selector('li.list-inline-item > img', count: 6)
expect(rendered_content).to have_css('li.list-inline-item > img', count: 6)
end
end

Expand All @@ -45,23 +45,23 @@
end

it "renders an avatar for the BsRequest's creator with the avatar title being the creator's real name" do
expect(rendered_content).to have_selector('li.list-inline-item > img[title="Johnny Dupuis"]', count: 1)
expect(rendered_content).to have_css('li.list-inline-item > img[title="Johnny Dupuis"]', count: 1)
end

it "renders an avatar for a group review with the avatar title being the group's title" do
expect(rendered_content).to have_selector('li.list-inline-item > img[title="Canailles"]', count: 1)
expect(rendered_content).to have_css('li.list-inline-item > img[title="Canailles"]', count: 1)
end

it "renders an avatar for a user review with the avatar title being the user's real name" do
expect(rendered_content).to have_selector('li.list-inline-item > img[title="Jane Doe"]', count: 1)
expect(rendered_content).to have_css('li.list-inline-item > img[title="Jane Doe"]', count: 1)
end

it "renders an avatar for a package review with the avatar title being the package's project and name" do
expect(rendered_content).to have_selector('li.list-inline-item > span[title="Package project1/package1"]', count: 1)
expect(rendered_content).to have_css('li.list-inline-item > span[title="Package project1/package1"]', count: 1)
end

it "renders an avatar for a project review with the avatar title being the project's name" do
expect(rendered_content).to have_selector('li.list-inline-item > span[title="Project project2"]', count: 1)
expect(rendered_content).to have_css('li.list-inline-item > span[title="Project project2"]', count: 1)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:notification) { create(:web_notification, :request_created, notifiable: bs_request, subscriber: user) }

it do
expect(render_inline(described_class.new(notification.notifiable))).to have_selector('p', text: '')
expect(render_inline(described_class.new(notification.notifiable))).to have_css('p', text: '')
end
end

Expand All @@ -17,7 +17,7 @@
let(:notification) { create(:web_notification, :comment_for_project, notifiable: comment, subscriber: user) }

it do
expect(render_inline(described_class.new(notification.notifiable))).to have_selector('p', text: 'Nice project!')
expect(render_inline(described_class.new(notification.notifiable))).to have_css('p', text: 'Nice project!')
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/components/user_avatar_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

it 'renders the maintainers of the package' do
expect(rendered_content).to have_selector('img[title="Bob"]', count: 1)
expect(rendered_content).to have_css('img[title="Bob"]', count: 1)
end
end
end
Expand Down
Loading

0 comments on commit 320da2a

Please sign in to comment.