Skip to content

Commit

Permalink
Fix example wording exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed May 9, 2018
1 parent 74e7de8 commit 47efc62
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 56 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Expand Up @@ -188,14 +188,6 @@ RSpec/ExampleLength:
- 'spec/service_item_spec.rb'
- 'spec/update_marc_spec.rb'

# Offense count: 48
# Configuration parameters: CustomTransform, IgnoredWords.
RSpec/ExampleWording:
Exclude:
- 'spec/goobi_spec.rb'
- 'spec/service_item_spec.rb'
- 'spec/update_marc_spec.rb'

# Offense count: 1
RSpec/ExpectInHook:
Exclude:
Expand Down
4 changes: 2 additions & 2 deletions spec/goobi_spec.rb
Expand Up @@ -21,7 +21,7 @@
allow(@goobi).to receive(:collection_name).and_return('collection name')
end

it 'should create the correct xml request' do
it 'creates the correct xml request' do
expect(@goobi.xml_request).to be_equivalent_to <<-END
<stanfordCreationRequest>
<objectId>#{pid}</objectId>
Expand All @@ -40,7 +40,7 @@
END
end

it 'should make a call to the goobi server with the appropriate xml params' do
it 'makes a call to the goobi server with the appropriate xml params' do
FakeWeb.register_uri(:post, Dor::Config.goobi.url, body: '<somexml/>', content_type: 'text/xml')
expect(@goobi).to receive(:xml_request)
response = @goobi.register
Expand Down
36 changes: 18 additions & 18 deletions spec/service_item_spec.rb
Expand Up @@ -2,7 +2,7 @@

RSpec.describe Dor::ServiceItem do
describe '.catkey' do
it 'should return catkey from a valid identityMetadata' do
it 'returns catkey from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -15,7 +15,7 @@
expect(@si.previous_ckeys).to eq([])
end

it 'should return nil for current catkey but values for previous catkeys in identityMetadata' do
it 'returns nil for current catkey but values for previous catkeys in identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_5)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -28,7 +28,7 @@
expect(@si.previous_ckeys).to eq(%w(123 456))
end

it 'should return nil for current catkey and empty array for previous catkeys in identityMetadata without either' do
it 'returns nil for current catkey and empty array for previous catkeys in identityMetadata without either' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_4)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -43,7 +43,7 @@
end

describe '.goobi_workflow_name' do
it 'should return goobi_workflow_name from a valid identityMetadata' do
it 'returns goobi_workflow_name from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -54,7 +54,7 @@

expect(@si.goobi_workflow_name).to eq('book_workflow')
end
it 'should return first goobi_workflow_name if multiple are in the tags' do
it 'returns first goobi_workflow_name if multiple are in the tags' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -65,7 +65,7 @@

expect(@si.goobi_workflow_name).to eq('book_workflow')
end
it 'should return blank for goobi_workflow_name if none are found' do
it 'returns blank for goobi_workflow_name if none are found' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -79,7 +79,7 @@
end

describe '.object_type' do
it 'should return object_type from a valid identityMetadata' do
it 'returns object_type from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -90,7 +90,7 @@
expect(@si.object_type).to eq('item')
end

it 'should return a blank object type for identityMetadata without object_type' do
it 'returns a blank object type for identityMetadata without object_type' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_6)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -103,7 +103,7 @@
end

describe '.project_name' do
it 'should return project name from a valid identityMetadata' do
it 'returns project name from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -115,7 +115,7 @@
expect(@si.project_name).to eq('Batchelor Maps : Batch 1')
end

it 'should return blank for project name if not in tag' do
it 'returns blank for project name if not in tag' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -129,7 +129,7 @@
end

describe '.collection_name and id' do
it 'should return collection name and id from a valid identityMetadata' do
it 'returns collection name and id from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -145,7 +145,7 @@
expect(@si.collection_id).to eq('druid:cc111cc1111')
end

it 'should return blank for collection name and id if there are none' do
it 'returns blank for collection name and id if there are none' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -160,7 +160,7 @@
end

describe '.barcode' do
it 'should return barcode from a valid identityMetadata' do
it 'returns barcode from a valid identityMetadata' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_1)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand All @@ -171,7 +171,7 @@
expect(@si.barcode).to eq('36105216275185')
end

it 'should return an empty string without barcode' do
it 'returns an empty string without barcode' do
setup_test_objects('druid:aa111aa1111', '')
identity_metadata_ng_xml = Nokogiri::XML(build_identity_metadata_3)
identity_metadata_ds = double(Dor::IdentityMetadataDS)
Expand Down Expand Up @@ -200,21 +200,21 @@
allow(@rights_metadata_ds).to receive(:dra_object).and_return(Dor::RightsAuth.parse(@rights_metadata_ng_xml, true))
end

it 'should return the content_type_tag from dor-services if the value exists' do
it 'returns the content_type_tag from dor-services if the value exists' do
fake_tags = ['Tag 1', 'Tag 2', 'Process : Content Type : Process Value']
allow(@identity_metadata_ds).to receive_messages(:tags => fake_tags, :tag => fake_tags)
expect(Dor::ServiceItem.new(@d).content_type).to eq('Process Value')
end

it 'should return the type from contentMetadata if content_type_tag from dor-services does not have a value' do
it 'returns the type from contentMetadata if content_type_tag from dor-services does not have a value' do
fake_tags = ['Tag 1', 'Tag 2', 'Tag 3']
allow(@identity_metadata_ds).to receive_messages(:tags => fake_tags, :tag => fake_tags)
expect(Dor::ServiceItem.new(@d).content_type).to eq('map')
end
end

describe '.thumb' do
it 'should return thumb from a valid contentMetadata' do
it 'returns thumb from a valid contentMetadata' do
druid = 'bb111bb2222'
d = Dor::Item.new(:pid => druid)
content_metadata_ng_xml = Nokogiri::XML(build_content_metadata_1)
Expand All @@ -229,7 +229,7 @@
expect(Dor::ServiceItem.new(d).thumb).to eq('bb111bb2222%2Fwt183gy6220_00_0001.jp2')
end

it 'should return an empty string for contentMetadata without thumb' do
it 'returns an empty string for contentMetadata without thumb' do
druid = 'aa111aa2222'
d = Dor::Item.new(:pid => druid)
content_metadata_ng_xml = Nokogiri::XML(build_content_metadata_2)
Expand Down

0 comments on commit 47efc62

Please sign in to comment.