Skip to content

Commit

Permalink
add new cops and autocorrect (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
peetucket authored Mar 10, 2022
1 parent 649b288 commit db25b83
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,8 @@ Rails/RedundantTravelBack: # new in 2.12
Enabled: true
Rails/RootJoinChain: # new in 2.13
Enabled: true

RSpec/BeEq: # new in 2.9.0
Enabled: true
RSpec/BeNil: # new in 2.9.0
Enabled: true
4 changes: 2 additions & 2 deletions spec/lib/mais/update_authors_orcid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
expect(update_authors_orcid.update).to eq(1)

author_with_existing_orcid.reload
expect(author_with_existing_orcid.orcidid).to eq(nil)
expect(author_with_existing_orcid.orcidid).to be_nil

author_with_no_orcid.reload
expect(author_with_no_orcid.orcidid).to eq(nil)
expect(author_with_no_orcid.orcidid).to be_nil
end
end
end
2 changes: 1 addition & 1 deletion spec/lib/orcid/harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
# Creates Publication
publication = source_record.publication
expect(publication.title).to eq('Minds, Brains and Programs')
expect(publication.active).to eq(true)
expect(publication.active).to be(true)
expect(publication.pub_hash).to be_present

# With Identifiers
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/orcid/pub_mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
let(:pub_hash) { base_pub_hash.merge(abstract: nil) }

it 'does not add a short-description' do
expect(work['short-description']).to eq(nil)
expect(work['short-description']).to be_nil
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/web_of_science/harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
it_behaves_like 'it_can_process_records'

it 'logs exceptions for processing an author' do
expect(author.harvested).to be nil
expect(author.harvested).to be_nil
processor = WebOfScience::ProcessRecords.new(author, any_records_will_do)
allow(processor).to receive(:execute).and_raise(RuntimeError)
allow(WebOfScience::ProcessRecords).to receive(:new).and_return(processor)
Expand Down
4 changes: 2 additions & 2 deletions spec/models/author_identity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
expect(author.author_identities.length).to eq 1
expect(author.mirror_author_identities([existing_alt_identity])).to be false
expect(author.author_identities.length).to eq 1
expect(author.harvested).to be nil
expect(author.harvested).to be_nil
expect(author.changed?).to be false
expect(author.should_harvest?).to be false # no changes
end
Expand All @@ -159,7 +159,7 @@
expect(author.author_identities.length).to eq 1
expect(author.mirror_author_identities([existing_alt_identity, identity_same_as_primary])).to be false
expect(author.author_identities.length).to eq 1
expect(author.harvested).to be nil
expect(author.harvested).to be_nil
expect(author.changed?).to be false
expect(author.should_harvest?).to be false
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/author_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
it 'indicates if the primary author information changes but not the number of identities' do
expect(subject.should_harvest?).to be false
subject.preferred_first_name = "#{subject.first_name}XXX"
expect(subject.alt_identities_changed).to be nil
expect(subject.harvested).to be nil
expect(subject.alt_identities_changed).to be_nil
expect(subject.harvested).to be_nil
expect(subject.should_harvest?).to be true
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/tasks/cleanup_rake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

# the duped author is set to inactive
duped_author.reload
expect(duped_author.cap_import_enabled).to eq(false)
expect(duped_author.active_in_cap).to eq(false)
expect(duped_author.cap_import_enabled).to be(false)
expect(duped_author.active_in_cap).to be(false)
end
end
end

0 comments on commit db25b83

Please sign in to comment.