Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually fix two RuboCop offenses #16550

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/api/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,6 @@ RSpec/IndexedLet:
- 'spec/shared/contexts/a_user_and_subscriptions.rb'
- 'spec/shared/contexts/a_user_and_subscriptions_with_defaults.rb'

# Offense count: 1
RSpec/IteratedExpectation:
Exclude:
- 'spec/models/user_spec.rb'

# Offense count: 2
# Configuration parameters: EnforcedStyle.
# SupportedStyles: have_received, receive
Expand All @@ -761,12 +756,6 @@ RSpec/MessageSpies:
- 'spec/controllers/webui/apidocs_controller_spec.rb'
- 'spec/models/kiwi/image_spec.rb'

# Offense count: 13
RSpec/MissingExpectationTargetMethod:
Exclude:
- 'spec/models/package_get_by_project_and_name_spec.rb'
- 'spec/models/project_find_package_spec.rb'

# Offense count: 1618
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Expand Down
14 changes: 7 additions & 7 deletions src/api/spec/models/package_get_by_project_and_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let(:package) { create(:package, project: link_association.linked_db_project) }

it 'returns the package from the link' do
expect(subject.project).equal?(local_linked_project)
expect(subject.project).to eq(local_linked_project)
end
end

Expand All @@ -28,7 +28,7 @@
let(:package) { create(:package, name: package_in_link.name, project: link_association.project) }

it 'returns the package from the local project' do
expect(subject.project).equal?(project)
expect(subject.project).to eq(project)
end
end

Expand All @@ -50,7 +50,7 @@
let(:package) { build(:package, name: 'i_might_exist_remote') }

it 'returns nil' do
expect(subject).equal?(nil)
expect(subject).to be_nil
end

it 'does not raise' do
Expand Down Expand Up @@ -80,7 +80,7 @@
let(:package) { create(:package, name: package_in_link.name, project: link_association.project) }

it 'returns the package from the local project' do
expect(subject.project).equal?(project)
expect(subject.project).to eq(project)
end
end

Expand Down Expand Up @@ -124,7 +124,7 @@
let(:package) { create(:package, project: update_project) }

it 'returns the package from the link' do
expect(subject.project).equal?(update_project)
expect(subject.project).to eq(update_project)
end
end

Expand All @@ -133,7 +133,7 @@
let(:package) { create(:package, name: updated_package.name, project: project) }

it 'returns the package from the link' do
expect(subject.project).equal?(update_project)
expect(subject.project).to eq(update_project)
end
end

Expand Down Expand Up @@ -168,7 +168,7 @@
let(:package) { create(:package, name: updated_package.name, project: project) }

it 'does not find the package from the link' do
expect(subject.project).equal?(project)
expect(subject.project).to eq(project)
end
end

Expand Down
12 changes: 6 additions & 6 deletions src/api/spec/models/project_find_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
let(:package) { create(:package, project: project) }

it 'returns the package from the link' do
expect(subject.project).equal?(link_target)
expect(subject.project).equal?(link_target) # rubocop:disable RSpec/MissingExpectationTargetMethod FIXME
danidoni marked this conversation as resolved.
Show resolved Hide resolved
end
end

context 'and linked project provides package and local project not' do
let(:package) { create(:package, project: link_target) }

it 'returns the package from the link' do
expect(subject.project).equal?(link_target)
expect(subject.project).to eq(link_target)
end
end

Expand All @@ -40,7 +40,7 @@
let(:package) { create(:package, name: package_in_linked_project.name, project: project) }

it 'returns the package from the link' do
expect(subject.project).equal?(link_target)
expect(subject.project).equal?(link_target) # rubocop:disable RSpec/MissingExpectationTargetMethod FIXME
end
end

Expand Down Expand Up @@ -69,15 +69,15 @@
let(:package) { create(:package, project: update_project) }

it 'returns the package from the link' do
expect(subject.project).equal?(update_project)
expect(subject.project).to eq(update_project)
end
end

context 'and local project provides package and linked project not' do
let(:package) { create(:package, project: project) }

it 'returns the package from the local project' do
expect(subject.project).equal?(project)
expect(subject.project).to eq(project)
end
end

Expand All @@ -86,7 +86,7 @@
let(:package) { create(:package, name: updated_package.name, project: project) }

it 'returns the package from the link' do
expect(subject.project).equal?(update_project)
expect(subject.project).to eq(update_project)
end
end

Expand Down
4 changes: 1 addition & 3 deletions src/api/spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@

it 'returns an ActiveRecord::Relation of bs requests' do
expect(subject).to be_a(ActiveRecord::Relation)
subject.each do |item|
expect(item).to be_instance_of(BsRequest)
end
expect(subject).to all(be_instance_of(BsRequest))
end

it 'does include reviews where the user is not the creator of the request' do
Expand Down