Skip to content

Commit

Permalink
Update to latest rubocop and rubocop-rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed May 20, 2016
1 parent 506e75f commit d2a6c3c
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ RSpec/DescribeClass:
RSpec/FilePath:
Exclude:
- 'spec/routing/**/*'

RSpec/VerifiedDoubles:
Enabled: false

RSpec/ExampleLength:
Max: 16
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ group :development, :test do
gem 'solr_wrapper', '~> 0.10'
gem 'fcrepo_wrapper', '~> 0.4'

gem 'rubocop', '~> 0.39.0'
gem 'rubocop-rspec', '~> 1.4.1'
gem 'rubocop', '~> 0.40'
gem 'rubocop-rspec', '~> 1.5'
end

group :development do
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -626,14 +626,14 @@ GEM
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubocop (0.39.0)
parser (>= 2.3.0.7, < 3.0)
rubocop (0.40.0)
parser (>= 2.3.1.0, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.4.1)
rubocop (= 0.39.0)
rubocop-rspec (1.5.0)
rubocop (>= 0.40.0)
ruby-box (1.15.0)
addressable
json
Expand Down Expand Up @@ -789,8 +789,8 @@ DEPENDENCIES
rsolr (~> 1.0.6)
rspec
rspec-rails
rubocop (~> 0.39.0)
rubocop-rspec (~> 1.4.1)
rubocop (~> 0.40)
rubocop-rspec (~> 1.5)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
sidekiq
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/admin/features_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class Admin::FeaturesController < Flip::FeaturesController
before_action do
authorize! :manage, Feature
module Admin
class FeaturesController < Flip::FeaturesController
before_action do
authorize! :manage, Feature
end
end
end
8 changes: 5 additions & 3 deletions app/controllers/admin/strategies_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class Admin::StrategiesController < Flip::StrategiesController
before_action do
authorize! :manage, Feature
module Admin
class StrategiesController < Flip::StrategiesController
before_action do
authorize! :manage, Feature
end
end
end
20 changes: 11 additions & 9 deletions app/presenters/curation_concerns/generic_work_show_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
class CurationConcerns::GenericWorkShowPresenter < Sufia::WorkShowPresenter
self.file_presenter_class = Hybox::FileSetPresenter
module CurationConcerns
class GenericWorkShowPresenter < Sufia::WorkShowPresenter
self.file_presenter_class = Hybox::FileSetPresenter

def manifest_url
manifest_helper.polymorphic_url([:manifest, self])
end
def manifest_url
manifest_helper.polymorphic_url([:manifest, self])
end

private
private

def manifest_helper
@manifest_helper ||= ManifestHelper.new(request.base_url)
end
def manifest_helper
@manifest_helper ||= ManifestHelper.new(request.base_url)
end
end
end
6 changes: 4 additions & 2 deletions lib/importer/factory/object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ def create

def log_created(obj)
Rails.logger.info(
"Created #{klass.model_name.human} #{obj.id} (#{Array(attributes[system_identifier_field]).first})")
"Created #{klass.model_name.human} #{obj.id} (#{Array(attributes[system_identifier_field]).first})"
)
end

def log_updated(obj)
Rails.logger.info(
"Updated #{klass.model_name.human} #{obj.id} (#{Array(attributes[system_identifier_field]).first})")
"Updated #{klass.model_name.human} #{obj.id} (#{Array(attributes[system_identifier_field]).first})"
)
end

private
Expand Down
3 changes: 1 addition & 2 deletions lib/importer/mods_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ def build_date(node)
finish = finish_point(node)
start = start_point(node)
dates = [{ start: start.map(&:text), finish: finish.map(&:text), label: date_label(node),
start_qualifier: qualifier(start), finish_qualifier: qualifier(finish)
}]
start_qualifier: qualifier(start), finish_qualifier: qualifier(finish) }]
dates.delete_if { |date| date.values.all?(&:blank?) }
dates
end
Expand Down
3 changes: 1 addition & 2 deletions lib/stanford/importer/purl_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def dates

def identifiers
{ identifiers: oai.xpath('./dc:identifier', DC_NS).map(&:text),
id: xml.xpath('//identityMetadata/objectId').text.sub('druid:', '')
}
id: xml.xpath('//identityMetadata/objectId').text.sub('druid:', '') }
end

def record_origin
Expand Down
3 changes: 1 addition & 2 deletions spec/features/accounts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
let(:user) { FactoryGirl.create(:superadmin) }
let(:account) do
FactoryGirl.create(:account, solr_endpoint_attributes: { url: 'http://localhost:8080/solr' },
fcrepo_endpoint_attributes: { url: 'http://localhost:8080/fcrepo' }
)
fcrepo_endpoint_attributes: { url: 'http://localhost:8080/fcrepo' })
end

before do
Expand Down
3 changes: 1 addition & 2 deletions spec/lib/importer/factory/string_literal_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
RSpec.describe Importer::Factory::StringLiteralProcessor do
let(:input) do
{ title: ["Stanford residences"],
contributor: [{ name: name, type: "corporate" }]
}
contributor: [{ name: name, type: "corporate" }] }
end
subject { described_class.process(input) }

Expand Down
24 changes: 16 additions & 8 deletions spec/lib/importer/mods_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@
expect(attributes[:series_name]).to eq []
expect(attributes[:restrictions]).to eq []
expect(attributes[:institution]).to eq [
"Stanford University. Libraries. Dept. of Special Collections & University Archives."]
"Stanford University. Libraries. Dept. of Special Collections & University Archives."
]
end

context 'with a file that has a general (untyped) note' do
let(:file) { 'spec/fixtures/mods/shpc/druid_xv169dn4538.mods' }
it 'imports notes' do
expect(attributes[:notes_attributes].first[:value]).to start_with(
"\"Left to right: Anna Maria Lathrop")
"\"Left to right: Anna Maria Lathrop"
)
end
end

Expand Down Expand Up @@ -112,7 +114,8 @@
finish: ['1919'],
label: ['circa 1910s'],
start_qualifier: ['approximate'],
finish_qualifier: ['approximate'] }]
finish_qualifier: ['approximate'] }
]
end
end

Expand All @@ -137,7 +140,8 @@
finish: ['1959'],
label: ['circa 1900s-1950s'],
start_qualifier: ['approximate'],
finish_qualifier: ['approximate'] }]
finish_qualifier: ['approximate'] }
]
end
end

Expand All @@ -149,7 +153,8 @@
finish: [],
label: [],
start_qualifier: [],
finish_qualifier: [] }]
finish_qualifier: [] }
]
end
end

Expand All @@ -165,7 +170,8 @@
finish: [],
label: [],
start_qualifier: [],
finish_qualifier: [] }]
finish_qualifier: [] }
]
end
end

Expand All @@ -181,7 +187,8 @@
finish: [],
label: [],
start_qualifier: [],
finish_qualifier: [] }]
finish_qualifier: [] }
]
end
end

Expand Down Expand Up @@ -213,7 +220,8 @@
expect(attributes[:language]).to eq ['eng']
expect(attributes[:work_type]).to eq ['still image']
expect(attributes[:institution]).to eq [
'Dept. of Special Collections & University Archives Stanford Univeristy Libraries']
'Dept. of Special Collections & University Archives Stanford Univeristy Libraries'
]
end
end
end

0 comments on commit d2a6c3c

Please sign in to comment.