maltese 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/spec/sitemap_spec.rb CHANGED
@@ -1,17 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Maltese::Sitemap, vcr: true do
4
- before(:each) { allow(Time).to receive(:now).and_return(Time.mktime(2018, 4, 9)) }
5
-
6
4
  subject { Maltese::Sitemap.new }
7
5
 
6
+ let(:total) { 10 }
7
+ let(:doi) { "10.15771/IMEJIDEV.RM" }
8
+ let(:from_date) { (Date.current - 1.day).strftime("%F") }
9
+ let(:until_date) { Date.current.strftime("%F") }
10
+
8
11
  context "get_query_url" do
9
12
  it "default" do
10
- expect(subject.get_query_url).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B2018-04-08T00%3A00%3A00Z+TO+2018-04-09T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=50000&fl=doi%2Cupdated&sort=updated+asc&wt=json")
13
+ expect(subject.get_query_url).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B#{from_date}T00%3A00%3A00Z+TO+#{until_date}T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=50000&fl=doi%2Cupdated&sort=updated+asc&wt=json")
11
14
  end
12
15
 
13
16
  it "with zero rows" do
14
- expect(subject.get_query_url(rows: 0)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B2018-04-08T00%3A00%3A00Z+TO+2018-04-09T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=0&fl=doi%2Cupdated&sort=updated+asc&wt=json")
17
+ expect(subject.get_query_url(rows: 0)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B#{from_date}T00%3A00%3A00Z+TO+#{until_date}T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=0&fl=doi%2Cupdated&sort=updated+asc&wt=json")
15
18
  end
16
19
 
17
20
  it "with different from_date and until_date" do
@@ -20,17 +23,17 @@ describe Maltese::Sitemap, vcr: true do
20
23
  end
21
24
 
22
25
  it "with offset" do
23
- expect(subject.get_query_url(offset: 250)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B2018-04-08T00%3A00%3A00Z+TO+2018-04-09T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=250&rows=50000&fl=doi%2Cupdated&sort=updated+asc&wt=json")
26
+ expect(subject.get_query_url(offset: 250)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B#{from_date}T00%3A00%3A00Z+TO+#{until_date}T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=250&rows=50000&fl=doi%2Cupdated&sort=updated+asc&wt=json")
24
27
  end
25
28
 
26
29
  it "with rows" do
27
- expect(subject.get_query_url(rows: 250)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B2018-04-08T00%3A00%3A00Z+TO+2018-04-09T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=250&fl=doi%2Cupdated&sort=updated+asc&wt=json")
30
+ expect(subject.get_query_url(rows: 250)).to eq("https://solr.test.datacite.org/api?q=*%3A*&fq=updated%3A%5B#{from_date}T00%3A00%3A00Z+TO+#{until_date}T23%3A59%3A59Z%5D+AND+has_metadata%3Atrue+AND+is_active%3Atrue&start=0&rows=250&fl=doi%2Cupdated&sort=updated+asc&wt=json")
28
31
  end
29
32
  end
30
33
 
31
34
  context "get_total" do
32
35
  it "with works" do
33
- expect(subject.get_total).to eq(4)
36
+ expect(subject.get_total).to eq(total)
34
37
  end
35
38
 
36
39
  it "with no works" do
@@ -48,7 +51,7 @@ describe Maltese::Sitemap, vcr: true do
48
51
 
49
52
  it "should report if there are works returned by the Datacite Solr API" do
50
53
  response = subject.queue_jobs
51
- expect(response).to eq(4)
54
+ expect(response).to eq(total)
52
55
  end
53
56
  end
54
57
 
@@ -61,9 +64,9 @@ describe Maltese::Sitemap, vcr: true do
61
64
 
62
65
  it "should report if there are works returned by the Datacite Solr API" do
63
66
  response = subject.get_data
64
- expect(response.body.dig("data", "response", "numFound")).to eq(4)
67
+ expect(response.body.dig("data", "response", "numFound")).to eq(total)
65
68
  doc = response.body.dig("data", "response", "docs").first
66
- expect(doc["doi"]).to eq("10.5256/F1000RESEARCH.68843.R16717")
69
+ expect(doc["doi"]).to eq(doi)
67
70
  end
68
71
 
69
72
  it "should catch errors with the Datacite Solr API" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maltese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-08 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -93,19 +93,19 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '6.0'
95
95
  - !ruby/object:Gem::Dependency
96
- name: fog-aws
96
+ name: aws-sdk-s3
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 0.7.6
101
+ version: '1.19'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 0.7.6
108
+ version: '1.19'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: mime-types
111
111
  requirement: !ruby/object:Gem::Requirement