Skip to content

Commit

Permalink
style: fix LetBeforeExamples
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsin johnson committed Jun 10, 2020
1 parent ba48c24 commit 07e4727
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 40 deletions.
9 changes: 0 additions & 9 deletions .rubocop_fixme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,6 @@ RSpec/AnyInstance:
RSpec/ExpectInHook:
Enabled: false

# Offense count: 31
RSpec/LetBeforeExamples:
Exclude:
- 'spec/forms/hyrax/forms/collection_form_spec.rb'
- 'spec/presenters/hyrax/collection_presenter_spec.rb'
- 'spec/presenters/hyrax/trophy_presenter_spec.rb'
- 'spec/services/hyrax/workflow/action_taken_service_spec.rb'
- 'spec/services/hyrax/workflow/notification_service_spec.rb'

# Offense count: 27
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: and_return, block
Expand Down
10 changes: 5 additions & 5 deletions spec/forms/hyrax/forms/collection_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
describe "#terms" do
subject { described_class.terms }

let(:collection) { build(:collection_lw) }
let(:ability) { Ability.new(create(:user)) }
let(:repository) { double }
let(:form) { described_class.new(collection, ability, repository) }

it do
is_expected.to eq [:alternative_title,
:resource_type,
Expand All @@ -25,11 +30,6 @@
end
end

let(:collection) { build(:collection_lw) }
let(:ability) { Ability.new(create(:user)) }
let(:repository) { double }
let(:form) { described_class.new(collection, ability, repository) }

describe "#primary_terms" do
subject { form.primary_terms }

Expand Down
22 changes: 11 additions & 11 deletions spec/presenters/hyrax/collection_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
RSpec.describe Hyrax::CollectionPresenter do
describe ".terms" do
subject { described_class.terms }

it do
is_expected.to eq [:total_items, :size, :resource_type, :creator,
:contributor, :keyword, :license, :publisher,
:date_created, :subject, :language, :identifier,
:based_near, :related_url]
end
end

let(:collection) do
build(:collection_lw,
id: 'adc12v',
Expand All @@ -25,6 +14,17 @@
let(:presenter) { described_class.new(solr_doc, ability) }
let(:solr_doc) { SolrDocument.new(collection.to_solr) }

describe ".terms" do
subject { described_class.terms }

it do
is_expected.to eq [:total_items, :size, :resource_type, :creator,
:contributor, :keyword, :license, :publisher,
:date_created, :subject, :language, :identifier,
:based_near, :related_url]
end
end

describe "collection type methods" do
subject { presenter }

Expand Down
6 changes: 3 additions & 3 deletions spec/presenters/hyrax/trophy_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
RSpec.describe Hyrax::TrophyPresenter do
let(:presenter) { described_class.new(solr_document) }
let(:solr_document) { SolrDocument.new(id: '123456', has_model_ssim: 'GenericWork', title_tesim: ['A Title']) }

describe "find_by_user" do
let(:user) { create(:user) }
let(:work1) { create(:work, user: user) }
Expand All @@ -16,9 +19,6 @@
end
end

let(:presenter) { described_class.new(solr_document) }
let(:solr_document) { SolrDocument.new(id: '123456', has_model_ssim: 'GenericWork', title_tesim: ['A Title']) }

describe "id" do
subject { presenter.id }

Expand Down
12 changes: 6 additions & 6 deletions spec/services/hyrax/workflow/action_taken_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
RSpec.describe Hyrax::Workflow::ActionTakenService do
context 'class methods' do
subject { described_class }

it { is_expected.to respond_to(:handle_action_taken) }
end

let(:triggered_methods) { [instance_double(Sipity::Method, service_name: 'FooBar')] }
let(:triggered_methods_rel) do
double('Sipity::Method::ActiveRecord_Relation',
Expand All @@ -21,6 +15,12 @@
user: user)
end

context 'class methods' do
subject { described_class }

it { is_expected.to respond_to(:handle_action_taken) }
end

describe "#call" do
subject { instance.call }

Expand Down
12 changes: 6 additions & 6 deletions spec/services/hyrax/workflow/notification_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
RSpec.describe Hyrax::Workflow::NotificationService do
context 'class methods' do
subject { described_class }

it { is_expected.to respond_to(:deliver_on_action_taken) }
end

let(:creating_user) { Sipity::Role.new(name: 'creating_user') }
let(:recipient1) do
Sipity::NotificationRecipient.new(recipient_strategy: 'to',
Expand All @@ -30,6 +24,12 @@
user: user)
end

context 'class methods' do
subject { described_class }

it { is_expected.to respond_to(:deliver_on_action_taken) }
end

describe "#call" do
subject { instance.call }

Expand Down

0 comments on commit 07e4727

Please sign in to comment.