Skip to content

Commit

Permalink
fixed registration_agency check for bmc_fulltext. #381
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 17, 2015
1 parent 90eee32 commit 3949308
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/sources/bmc_fulltext.rb
@@ -1,7 +1,7 @@
class BmcFulltext < Source
def get_query_url(work, options = {})
# don't query if work is BMC article
return {} if work.doi =~ /^10.1186/ && registration_agencies.include?(work.registration_agency)
return {} if work.doi =~ /^10.1186/ || !registration_agencies.include?(work.registration_agency)

query_string = get_query_string(work)
return {} unless query_string.present?
Expand Down
4 changes: 2 additions & 2 deletions spec/models/bmc_fulltext_spec.rb
Expand Up @@ -3,7 +3,7 @@
describe BmcFulltext, type: :model, vcr: true do
subject { FactoryGirl.create(:bmc_fulltext) }

let(:work) { FactoryGirl.create(:work, doi: nil, canonical_url: "https://github.com/najoshi/sickle") }
let(:work) { FactoryGirl.create(:work, doi: nil, canonical_url: "https://github.com/najoshi/sickle", registration_agency: "github") }

context "lookup canonical URL" do
it "should look up canonical URL if there is no work url" do
Expand All @@ -29,7 +29,7 @@
end

it "should report if there are no events returned by the BMC Search API" do
work = FactoryGirl.create(:work, doi: nil, canonical_url: "https://github.com/pymor/pymor")
work = FactoryGirl.create(:work, doi: nil, canonical_url: "https://github.com/pymor/pymor", registration_agency: "github")
response = subject.get_data(work)
expect(response).to eq("entries"=>[])
end
Expand Down

0 comments on commit 3949308

Please sign in to comment.