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

AO3-4719 Refactor work search tests #2615

Merged
merged 6 commits into from Nov 28, 2016
Merged

AO3-4719 Refactor work search tests #2615

merged 6 commits into from Nov 28, 2016

Conversation

zz9pzza
Copy link
Contributor

@zz9pzza zz9pzza commented Nov 6, 2016

Pull Request Checklist

  • Have you read How to write the perfect pull request?
  • Have you read through the contributor guidelines?
  • Have you added tests for any changed functionality?
  • Have you added the JIRA issue number as the first thing in your pull request title (eg: AO3-1234 Fix thing)
  • Have you updated the JIRA issue with the information below?

Issue

https://otwarchive.atlassian.net/browse/AO3-4719

Purpose

This just refactors the works searching, there will be another pull along in a bit to actually add coverage.

Testing

No manual testing

@@ -93,6 +93,18 @@

### GIVEN

Given(/^I have the Battle set loaded$/) do
Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative would have been to use a Background section in the Cucumber scenario, which would then make it clearer what has been loaded before each test for users who only read the feature file (if we ever get any "business" "stakeholders" to do that!). But as the Cucumber documentation recommends not having Backgrounds longer than 4 lines, and nobody who isn't a coder looks at them, I think this is probably the right approach here.

get :index, tag_id: @fandom.name
expect(assigns(:works).items).to include(@work)
expect(assigns(:works).items).not_to include(@work2)
end

xit "should show restricted works to logged-in users" do
it "should show restricted works to logged-in users" do
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the test that breaks the import specs (I enabled it locally to check and the story_parser tests failed). I suspect it's due to the fake_login method which amongst other things, stubs the current_user call to return a user who isn't an archivist, and then doesn't reset normal calls afterwards. I think this test needs to clean up after itself.

@sarken sarken changed the title AO3 4719 Refactor works searching AO3-4719 Refactor work search tests Nov 10, 2016
@zz9pzza
Copy link
Contributor Author

zz9pzza commented Nov 11, 2016

@ariana-paris @sarken it is unclear if you want me to move this to Background ?

@ariana-paris
Copy link
Contributor

No, the Background thing was just a suggestion. I only requested changes it because you needed to fix the test, which I guess you did by putting it back the way it was. Something for another day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants