From 862b92330df707f782b8fa46341144d09b41674f Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 7 Mar 2020 06:37:39 +0100 Subject: [PATCH] fix specs. --- app/controllers/export_controller.rb | 2 +- app/models/concerns/indexable.rb | 4 ++-- spec/requests/exports_spec.rb | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index d8213c8c6..7a5ad1b59 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -257,7 +257,7 @@ def repositories accountName: name, fabricaAccountId: client.symbol, parentFabricaAccountId: client.provider.present? ? client.provider.symbol : nil, - isActive: client.deleted_at.blank? + isActive: client.deleted_at.blank?, accountDescription: client.description, accountWebsite: client.url, generalContactEmail: client.system_email, diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index c058684b2..ada8c056d 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -233,7 +233,7 @@ def query(query, options={}) must << { term: { opendoar_id: options[:opendoar_id] }} if options[:opendoar_id].present? must << { term: { client_type: options[:client_type] }} if options[:client_type].present? must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted] - must_not << { terms: { symbol: !%w(CROSSREF.CITATIONS MEDRA.CITATIONS JALC.CITATIONS KISTI.CITATIONS OP.CITATIONS) }} if options[:exclude_registration_agencies] + must_not << { terms: { uid: %w(crossref.citations medra.citations jalc.citations kisti.citations op.citations) }} if options[:exclude_registration_agencies] elsif self.name == "Doi" must << { terms: { aasm_state: options[:state].to_s.split(",") }} if options[:state].present? must << { range: { registered: { gte: "#{options[:registered].split(",").min}||/y", lte: "#{options[:registered].split(",").max}||/y", format: "yyyy" }}} if options[:registered].present? @@ -243,7 +243,7 @@ def query(query, options={}) must << { term: { "client.re3data_id" => options[:re3data_id].gsub("/", '\/').upcase }} if options[:re3data_id].present? must << { term: { "client.opendoar_id" => options[:opendoar_id] }} if options[:opendoar_id].present? must << { terms: { "client.certificate" => options[:certificate].split(",") }} if options[:certificate].present? - must_not << { terms: { "client.symbol" => !%w(CROSSREF.CITATIONS MEDRA.CITATIONS JALC.CITATIONS KISTI.CITATIONS OP.CITATIONS) }} if options[:exclude_registration_agencies] + must_not << { terms: { "client.uid" => %w(crossref.citations medra.citations jalc.citations kisti.citations op.citations) }} if options[:exclude_registration_agencies] elsif self.name == "Event" must << { term: { subj_id: URI.decode(options[:subj_id]) }} if options[:subj_id].present? must << { term: { obj_id: URI.decode(options[:obj_id]) }} if options[:obj_id].present? diff --git a/spec/requests/exports_spec.rb b/spec/requests/exports_spec.rb index 0b51f390c..e698a96c0 100644 --- a/spec/requests/exports_spec.rb +++ b/spec/requests/exports_spec.rb @@ -15,7 +15,6 @@ let!(:dois) { create_list(:doi, 3, client: client, aasm_state: "findable") } describe "GET /export/organizations", elasticsearch: true do - before do Doi.import Provider.import @@ -27,11 +26,9 @@ expect(last_response.status).to eq(200) end - end describe "GET /export/repositories", elasticsearch: true do - before do Doi.import Client.import @@ -43,11 +40,9 @@ expect(last_response.status).to eq(200) end - end describe "GET /export/contacts", elasticsearch: true do - before do Doi.import Client.import @@ -60,7 +55,5 @@ expect(last_response.status).to eq(200) end - end - end