Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Remove low-value specs #58

Merged
merged 2 commits into from
Oct 5, 2023
Merged

🧹 Remove low-value specs #58

merged 2 commits into from
Oct 5, 2023

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Oct 5, 2023

In reviewing these failing specs, it is testing the behavior of a
presenter by way of fiddling with the internals of a controller.
Further, these tested controllers are not in the knapsack.

So ✂✂✂ goes the code. This spec has been in Hyku for 7 years
and it's time to not bring them into the knapsack.

Spec to get working
RSpec.describe Hyrax::GenericWorksController do
  describe "#presenter" do
    subject { controller.send :presenter }

    let(:solr_document) { SolrDocument.new(FactoryBot.create(:generic_work).to_solr) }

    before do
      allow(controller).to receive(:search_result_document).and_return(solr_document)
    end

    it "initializes a presenter" do
      expect(subject).to be_kind_of Hyku::WorkShowPresenter
      expect(subject.manifest_url).to eq "http://test.host/concern/generic_works/#{solr_document.to_param}/manifest"
    end
  end
end

🧹 Appease the coppers

96460aa

Copy link
Contributor

@kirkkwang kirkkwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

In reviewing these failing specs, it is testing the behavior of a
presenter by way of fiddling with the internals of a controller.
Further, these tested controllers are not in the knapsack.

So ✂✂✂ goes the code.  This spec has been in Hyku for 7 years
and it's time to not bring them into the knapsack.

<details><summary>Spec to get working</summary>

```ruby

RSpec.describe Hyrax::GenericWorksController do
  describe "#presenter" do
    subject { controller.send :presenter }

    let(:solr_document) { SolrDocument.new(FactoryBot.create(:generic_work).to_solr) }

    before do
      allow(controller).to receive(:search_result_document).and_return(solr_document)
    end

    it "initializes a presenter" do
      expect(subject).to be_kind_of Hyku::WorkShowPresenter
      expect(subject.manifest_url).to eq "http://test.host/concern/generic_works/#{solr_document.to_param}/manifest"
    end
  end
end
```

</details>
@jeremyf jeremyf merged commit df141c2 into main Oct 5, 2023
7 checks passed
@jeremyf jeremyf deleted the remove-useless-specs branch October 5, 2023 14:23
@jeremyf jeremyf mentioned this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants