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

WoS DOI Search #242

Merged
merged 2 commits into from
Oct 6, 2017
Merged

WoS DOI Search #242

merged 2 commits into from
Oct 6, 2017

Conversation

dazza-codes
Copy link
Contributor

@dazza-codes dazza-codes commented Oct 4, 2017

@dazza-codes dazza-codes mentioned this pull request Oct 5, 2017
4 tasks
@dazza-codes dazza-codes force-pushed the doi-search branch 3 times, most recently from 2011795 to 7e36e90 Compare October 5, 2017 23:36
@dazza-codes dazza-codes changed the title [WIP, Depends 223] DOI search [WIP] Generic User Query and DOI Search Oct 6, 2017
@dazza-codes dazza-codes force-pushed the doi-search branch 3 times, most recently from 558c2df to 2454cd9 Compare October 6, 2017 19:40
@dazza-codes dazza-codes changed the title [WIP] Generic User Query and DOI Search [WIP, Depends 250] Generic User Query and DOI Search Oct 6, 2017
@dazza-codes dazza-codes changed the title [WIP, Depends 250] Generic User Query and DOI Search [WIP, Depends 250] WoS DOI Search Oct 6, 2017
@dazza-codes dazza-codes changed the title [WIP, Depends 250] WoS DOI Search WoS DOI Search Oct 6, 2017
# Return a unique DOI match or nothing, because the WoS API does partial string matching
# on the `DO` field. When the result set is only one record, it's likely to be a good match; but
# otherwise the results could be nonsense.
return records if records.count == 1
Copy link
Member

Choose a reason for hiding this comment

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

just reminding myself -- this return will prevent the following line from executing when reached, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, when records.count == 1 it returns records and short-circuits the rest of the block.

savon.expects(:search).with(message: :any).returns(wos_search_by_doi_mismatch_response)
result = wos_queries.search_by_doi(doi)
expect(result).to be_an WosRecords
expect(result).to be_empty
Copy link
Member

Choose a reason for hiding this comment

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

took me a second to understand why the same DOI passed in the two tests led to different results ... which of course works since the response is mocked differently as needed (i.e. the actual value of the incoming DOI is irrelevant for the tests) - maybe a small comment next to the let(:doi) statement to point that out?

@peetucket peetucket merged commit 2c2580b into master Oct 6, 2017
@peetucket peetucket deleted the doi-search branch October 6, 2017 22:12
@dazza-codes dazza-codes self-assigned this Oct 6, 2017
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