Skip to content

Commit

Permalink
Omit the default :each argument for before hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed May 9, 2018
1 parent 74e7de8 commit 9b28514
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 25 deletions.
14 changes: 0 additions & 14 deletions .rubocop_todo.yml
Expand Up @@ -210,20 +210,6 @@ RSpec/FilePath:
- 'spec/service_item_spec.rb'
- 'spec/update_marc_spec.rb'

# Offense count: 11
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/controllers/objects_controller_spec.rb'
- 'spec/controllers/sdr_controller_spec.rb'
- 'spec/controllers/versions_controller_spec.rb'
- 'spec/controllers/workflows_controller_spec.rb'
- 'spec/goobi_spec.rb'
- 'spec/registration_response_spec.rb'
- 'spec/service_item_spec.rb'
- 'spec/update_marc_spec.rb'

# Offense count: 134
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/objects_controller_spec.rb
Expand Up @@ -7,7 +7,7 @@

let(:item) { AssembleableVersionableItem.new.tap { |x| x.pid = 'druid:aa123bb4567' } }

before(:each) do
before do
allow(Dor).to receive(:find).and_return(item)
rights_metadata_xml = Dor::RightsMetadataDS.new
allow(rights_metadata_xml).to receive_messages(:ng_xml => Nokogiri::XML('<xml/>'))
Expand Down Expand Up @@ -64,7 +64,7 @@
end

context 'error handling' do
before(:each) do
before do
druid = DruidTools::Druid.new(item.pid, TEST_WORKSPACE)
druid.mkdir
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/sdr_controller_spec.rb
Expand Up @@ -3,7 +3,7 @@
RSpec.describe SdrController do
let(:item) { AssembleableVersionableItem.new.tap { |x| x.pid = 'druid:aa123bb4567' } }

before(:each) do
before do
allow(Dor).to receive(:find).and_return(item)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/versions_controller_spec.rb
Expand Up @@ -3,7 +3,7 @@
RSpec.describe VersionsController do
let(:item) { AssembleableVersionableItem.new.tap { |x| x.pid = 'druid:aa123bb4567' } }

before(:each) do
before do
allow(Dor).to receive(:find).and_return(item)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/workflows_controller_spec.rb
Expand Up @@ -23,7 +23,7 @@
describe 'workflow archiving' do
let(:item) { AssembleableVersionableItem.new.tap { |x| x.pid = 'druid:aa123bb4567' } }

before(:each) do
before do
allow(Dor).to receive(:find).with(item.pid).and_return(item)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/goobi_spec.rb
Expand Up @@ -4,7 +4,7 @@
let(:pid) { 'druid:aa123bb4567' }
let(:item) { Dor::Item.new(pid: pid) }

before(:each) do
before do
# all of the methods we are stubbing out below are tested elsewhere,
# this just lets us test the methods in goobi.rb without doing a lot of setup
allow(Dor::Item).to receive(:find).and_return(item)
Expand Down
2 changes: 1 addition & 1 deletion spec/registration_response_spec.rb
Expand Up @@ -2,7 +2,7 @@

RSpec.describe Dor::RegistrationResponse do
describe 'self marshalling' do
before(:each) do
before do
@params = {
:object_type => 'item',
:content_model => 'googleScannedBook',
Expand Down
2 changes: 1 addition & 1 deletion spec/service_item_spec.rb
Expand Up @@ -184,7 +184,7 @@
end

describe '.content_type' do
before :each do
before do
druid = 'bb111bb2222'
@d = Dor::Item.new(:pid => druid)
@content_metadata_ng_xml = Nokogiri::XML(build_content_metadata_1)
Expand Down
6 changes: 3 additions & 3 deletions spec/update_marc_spec.rb
Expand Up @@ -51,7 +51,7 @@
let(:rights_metadata_xml) { double(String) }
let(:release_data) { { 'Searchworks' => { 'release' => true } } }

before :each do
before do
allow(item).to receive(:released_for).and_return(release_data)
allow(collection).to receive(:released_for).and_return(release_data)
end
Expand Down Expand Up @@ -286,15 +286,15 @@
end

describe '.write_symphony_records' do
before :each do
before do
Dor::Config.release.symphony_path = "#{@fixtures}/sdr_purl"
Dor::Config.release.write_marc_script = 'bin/write_marc_record_test'
@output_file = "#{@fixtures}/sdr_purl/sdr-purl-856s"
setup_test_objects('druid:aa111aa1111', '')
@updater = Dor::UpdateMarcRecordService.new(@dor_item)
expect(File.exist?(@output_file)).to be_falsey
end
after :each do
after do
FileUtils.rm_f(@output_file)
end

Expand Down

0 comments on commit 9b28514

Please sign in to comment.