bento_search 1.3.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -2
- data/app/controllers/bento_search/search_controller.rb +1 -1
- data/app/models/bento_search/author.rb +6 -4
- data/app/models/bento_search/link.rb +8 -5
- data/app/models/bento_search/multi_searcher.rb +1 -1
- data/app/models/bento_search/registrar.rb +2 -1
- data/app/models/bento_search/result_item.rb +37 -21
- data/app/models/bento_search/results/serialization.rb +136 -0
- data/app/models/bento_search/results.rb +46 -1
- data/app/models/bento_search/search_engine.rb +22 -17
- data/app/search_engines/bento_search/eds_engine.rb +1 -1
- data/app/search_engines/bento_search/journal_tocs_for_journal.rb +21 -3
- data/lib/bento_search/version.rb +1 -1
- data/lib/bento_search.rb +5 -2
- data/test/search_engines/journal_tocs_for_journal_test.rb +117 -93
- data/test/search_engines/search_engine_test.rb +1 -1
- data/test/unit/serialization_test.rb +249 -0
- data/test/vcr_cassettes/journal_tocs/empty_results_on_bad_ISSN.yml +19 -25
- data/test/vcr_cassettes/journal_tocs/error_on_bad_registered_email.yml +19 -26
- data/test/vcr_cassettes/journal_tocs/error_on_error_response.yml +33 -37
- data/test/vcr_cassettes/journal_tocs/fetch_xml_with_hits.yml +308 -305
- data/test/vcr_cassettes/journal_tocs/fills_out_metadata.yml +515 -377
- data/test/vcr_cassettes/journal_tocs/smoke_test.yml +308 -305
- data/test/vcr_cassettes/journal_tocs/sorts_by_date.yml +922 -0
- metadata +7 -6
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -164426
@@ -50,8 +50,13 @@ module BentoSearch
|
|
50
50
|
url = request_url(issn)
|
51
51
|
response = http_client.get(url)
|
52
52
|
|
53
|
+
# In some cases, status 401 seems to be bad email
|
53
54
|
unless response.ok?
|
54
|
-
|
55
|
+
# trim some XML boilerplate and remove newlines
|
56
|
+
# from response body, for better error message
|
57
|
+
response_body = response.body.gsub(/[\n\t]/, '').sub(/\A<\?xml[^>]*\>/, '')
|
58
|
+
|
59
|
+
raise FetchError.new("#{url}: returns #{response.status} response: #{response_body}")
|
55
60
|
end
|
56
61
|
|
57
62
|
Nokogiri::XML(response.body)
|
@@ -76,7 +81,7 @@ module BentoSearch
|
|
76
81
|
xml = fetch_xml(issn)
|
77
82
|
|
78
83
|
|
79
|
-
BentoSearch::Results.new.concat(
|
84
|
+
results = BentoSearch::Results.new.concat(
|
80
85
|
xml.xpath("./rdf:RDF/rss:item", xml_ns).collect do |node|
|
81
86
|
item = BentoSearch::ResultItem.new
|
82
87
|
|
@@ -128,6 +133,9 @@ module BentoSearch
|
|
128
133
|
date_node = xml_text(node, "prism:coverDate") || xml_text(node, "dc:date") || xml_text(node, "prism:publicationDate")
|
129
134
|
if date_node && date_node =~ /\A(\d\d\d\d-\d\d-\d\d)/
|
130
135
|
item.publication_date = Date.strptime( $1, "%Y-%m-%d")
|
136
|
+
elsif date_node
|
137
|
+
# Let's try a random parse, they give us all kinds of things I'm afraid
|
138
|
+
item.publication_date = Date.parse(date_node) rescue ArgumentError
|
131
139
|
end
|
132
140
|
|
133
141
|
# abstract, we need to strip possible HTML tags (sometimes they're
|
@@ -139,6 +147,16 @@ module BentoSearch
|
|
139
147
|
item
|
140
148
|
end
|
141
149
|
)
|
150
|
+
|
151
|
+
# Items seem to come back in arbitrary order, we want to sort
|
152
|
+
# by date reverse if we can
|
153
|
+
if results.all? {|i| i.publication_date.present? }
|
154
|
+
results.sort_by! {|i| i.publication_date}.reverse!
|
155
|
+
end
|
156
|
+
|
157
|
+
fill_in_search_metadata_for(results)
|
158
|
+
|
159
|
+
return results
|
142
160
|
end
|
143
161
|
|
144
162
|
# just a convenience method
|
@@ -172,7 +190,7 @@ module BentoSearch
|
|
172
190
|
["registered_email"]
|
173
191
|
end
|
174
192
|
|
175
|
-
class FetchError < ::
|
193
|
+
class FetchError < BentoSearch::FetchError ; end
|
176
194
|
|
177
195
|
|
178
196
|
end
|
data/lib/bento_search/version.rb
CHANGED
data/lib/bento_search.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'confstruct'
|
2
2
|
|
3
|
+
module BentoSearch
|
4
|
+
class Error < ::StandardError ; end
|
5
|
+
end
|
6
|
+
|
3
7
|
require "bento_search/engine"
|
4
8
|
require 'bento_search/routes'
|
5
9
|
|
@@ -20,8 +24,7 @@ if Hashie::Mash.instance_methods(false).include?(:id)
|
|
20
24
|
end
|
21
25
|
|
22
26
|
|
23
|
-
module BentoSearch
|
24
|
-
|
27
|
+
module BentoSearch
|
25
28
|
def self.global_registrar
|
26
29
|
@@global_registrar ||= BentoSearch::Registrar.new
|
27
30
|
end
|
@@ -1,93 +1,117 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class JournalTocsForJournalTest < ActiveSupport::TestCase
|
4
|
-
extend TestWithCassette
|
5
|
-
|
6
|
-
JournalTocsForJournal = BentoSearch::JournalTocsForJournal
|
7
|
-
|
8
|
-
@@registered_email = (ENV['JOURNAL_TOCS_REGISTERED_EMAIL'] || 'nobody@example.com')
|
9
|
-
|
10
|
-
|
11
|
-
VCR.configure do |c|
|
12
|
-
c.filter_sensitive_data("nobody@example.com", :journal_tocs) { @@registered_email }
|
13
|
-
end
|
14
|
-
|
15
|
-
def setup
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
assert_present first
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class JournalTocsForJournalTest < ActiveSupport::TestCase
|
4
|
+
extend TestWithCassette
|
5
|
+
|
6
|
+
JournalTocsForJournal = BentoSearch::JournalTocsForJournal
|
7
|
+
|
8
|
+
@@registered_email = (ENV['JOURNAL_TOCS_REGISTERED_EMAIL'] || 'nobody@example.com')
|
9
|
+
|
10
|
+
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.filter_sensitive_data("nobody@example.com", :journal_tocs) { @@registered_email }
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup
|
16
|
+
@test_engine_id = "test_journal_tocs_engine_id"
|
17
|
+
@test_decorator_name = "MockDecorator"
|
18
|
+
@engine = JournalTocsForJournal.new(:registered_email => @@registered_email,
|
19
|
+
:id => @test_engine_id,
|
20
|
+
:for_display => {:one => "one", :two => "two", :decorator => @test_decorator_name})
|
21
|
+
@test_display_config = @engine.configuration.for_display
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
test_with_cassette("fetch_xml with hits", :journal_tocs) do
|
26
|
+
xml = @engine.fetch_xml("1533290X")
|
27
|
+
|
28
|
+
assert_not_nil xml
|
29
|
+
assert_kind_of Nokogiri::XML::Document, xml
|
30
|
+
end
|
31
|
+
|
32
|
+
test_with_cassette("error on bad base url", :journal_tocs) do
|
33
|
+
engine = JournalTocsForJournal.new(:base_url => "http://doesnotexist.jhu.edu/", :registered_email => @@registered_email)
|
34
|
+
|
35
|
+
assert_raise JournalTocsForJournal::FetchError do
|
36
|
+
xml = engine.fetch_xml("1533290X")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
test_with_cassette("error on error response", :journal_tocs) do
|
41
|
+
engine = JournalTocsForJournal.new(:base_url => "http://www.journaltocs.ac.uk/bad_url", :registered_email => @@registered_email)
|
42
|
+
|
43
|
+
assert_raise JournalTocsForJournal::FetchError do
|
44
|
+
xml = engine.fetch_xml("1533290X")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
test_with_cassette("error on bad registered email", :journal_tocs) do
|
49
|
+
engine = JournalTocsForJournal.new(:registered_email => "unregistered@nowhere.com")
|
50
|
+
|
51
|
+
error = assert_raise JournalTocsForJournal::FetchError do
|
52
|
+
xml = engine.fetch_xml("1533290X")
|
53
|
+
end
|
54
|
+
|
55
|
+
assert error.message =~ /account is invalid/
|
56
|
+
end
|
57
|
+
|
58
|
+
test_with_cassette("smoke test", :journal_tocs) do
|
59
|
+
items = @engine.fetch_by_issn("1533290X")
|
60
|
+
|
61
|
+
assert_present items
|
62
|
+
assert_kind_of Array, items
|
63
|
+
assert_kind_of BentoSearch::Results, items
|
64
|
+
|
65
|
+
assert_equal @test_engine_id, items.engine_id
|
66
|
+
assert_equal @test_display_config.to_h, items.display_configuration.to_h
|
67
|
+
|
68
|
+
items.each do |item|
|
69
|
+
assert_kind_of BentoSearch::ResultItem, item
|
70
|
+
|
71
|
+
assert_equal @test_engine_id, item.engine_id
|
72
|
+
assert_equal @test_display_config.to_h, item.display_configuration.to_h
|
73
|
+
assert_equal @test_decorator_name, item.decorator
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
test_with_cassette("fills out metadata", :journal_tocs) do
|
78
|
+
# this ISSN has reasonably complete data in RSS feed
|
79
|
+
items = @engine.fetch_by_issn("1600-5740")
|
80
|
+
|
81
|
+
assert_present items.first
|
82
|
+
|
83
|
+
first = items.first
|
84
|
+
|
85
|
+
assert_present first.title
|
86
|
+
assert_present first.authors
|
87
|
+
assert_present first.authors.first.display
|
88
|
+
assert_present first.abstract
|
89
|
+
assert_present first.link
|
90
|
+
assert_present first.doi
|
91
|
+
assert_present first.publisher
|
92
|
+
assert_present first.source_title
|
93
|
+
assert_present first.volume
|
94
|
+
assert_present first.issue
|
95
|
+
assert_present first.start_page
|
96
|
+
assert_present first.end_page
|
97
|
+
assert_present first.publication_date
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
test_with_cassette("empty results on bad ISSN", :journal_tocs) do
|
102
|
+
items = @engine.fetch_by_issn("badissn")
|
103
|
+
|
104
|
+
assert items.empty?
|
105
|
+
end
|
106
|
+
|
107
|
+
test_with_cassette("sorts by date", :journal_tocs) do
|
108
|
+
items = @engine.fetch_by_issn("0026-2617")
|
109
|
+
|
110
|
+
(1..(items.length - 1)).each do |i|
|
111
|
+
assert items[i].publication_date <= items[i-1].publication_date, "Expected sorted in reverse date order"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
end
|
117
|
+
|
@@ -0,0 +1,249 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
class SerializationTest < ActiveSupport::TestCase
|
6
|
+
ResultItem = BentoSearch::ResultItem
|
7
|
+
MockEngine = BentoSearch::MockEngine
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@init_hash = {:title => "something",
|
11
|
+
:unique_id => "AAA11212",
|
12
|
+
:openurl_disabled => true,
|
13
|
+
:link => "http://www.example.org/something",
|
14
|
+
:link_is_fulltext => true,
|
15
|
+
:format => "Article",
|
16
|
+
:year => 2000,
|
17
|
+
:publication_date => Date.new(2000,1,1),
|
18
|
+
:volume => "10",
|
19
|
+
:issue => "22",
|
20
|
+
:start_page => "122",
|
21
|
+
:end_page => "124",
|
22
|
+
:language_code => "en",
|
23
|
+
:language_str => "English 22",
|
24
|
+
:source_title => "Journal of Things",
|
25
|
+
:issn => "12345678",
|
26
|
+
:isbn => "1234567890",
|
27
|
+
:oclcnum => "1",
|
28
|
+
:doi => "10.2.whatever",
|
29
|
+
:pmid => "12121212",
|
30
|
+
:publisher => "Joe Blow",
|
31
|
+
:abstract => "something or other",
|
32
|
+
:openurl_kev_co => "&rft.fake=fake",
|
33
|
+
:format_str => "Something or other",
|
34
|
+
:custom_data => {'foo' => "bar"},
|
35
|
+
:snippets => ["snippet one", "snippet two"]}
|
36
|
+
@result_item = ResultItem.new(@init_hash)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_item_serialization
|
40
|
+
r = ResultItem.new(@init_hash)
|
41
|
+
|
42
|
+
hash = r.internal_state_hash
|
43
|
+
|
44
|
+
r2 = ResultItem.from_internal_state_hash(hash)
|
45
|
+
|
46
|
+
assert_kind_of ResultItem, r2
|
47
|
+
|
48
|
+
@init_hash.each_pair do |key, value|
|
49
|
+
assert_equal value, r2.instance_variable_get("@#{key}")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class ::SerializationTest::ExampleDecorator < BentoSearch::StandardDecorator
|
54
|
+
def title
|
55
|
+
"DECORATED TITLE"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_item_serialization_not_decorated
|
60
|
+
r = ::SerializationTest::ExampleDecorator.new(ResultItem.new(@init_hash), nil)
|
61
|
+
|
62
|
+
assert_equal "DECORATED TITLE", r.title
|
63
|
+
|
64
|
+
hash = r.internal_state_hash
|
65
|
+
|
66
|
+
assert_present hash["title"]
|
67
|
+
refute_equal "DECORATED TITLE", hash["title"]
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_author_serialization
|
71
|
+
hash = {:first => "Jonathan", :last => "Rochkind", :middle => "A", :display => "Rochkind, Jonathan A."}
|
72
|
+
a = BentoSearch::Author.new(hash)
|
73
|
+
|
74
|
+
a2 = BentoSearch::Author.load_json( a.dump_to_json )
|
75
|
+
|
76
|
+
hash.each_pair do |key, value|
|
77
|
+
assert_equal value, a2.send(key)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_item_json_serialization
|
82
|
+
json_str = @result_item.dump_to_json
|
83
|
+
|
84
|
+
assert_kind_of String, json_str
|
85
|
+
|
86
|
+
r2 = ResultItem.load_json(json_str)
|
87
|
+
|
88
|
+
@init_hash.each_pair do |key, value|
|
89
|
+
assert_equal value, r2.instance_variable_get("@#{key}")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_item_html_safe_serialization
|
94
|
+
r = ResultItem.new(:title => "<b>foo</b>".html_safe)
|
95
|
+
|
96
|
+
r2 = ResultItem.load_json( r.dump_to_json )
|
97
|
+
|
98
|
+
assert r2.title.html_safe?
|
99
|
+
assert_equal "<b>foo</b>", r2.title
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_result_item_authors
|
103
|
+
r = ResultItem.new(:title => "foo")
|
104
|
+
r.authors << BentoSearch::Author.new(:first => "Jonathan", :last => "Rochkind")
|
105
|
+
|
106
|
+
hash = r.internal_state_hash
|
107
|
+
assert_kind_of Array, hash['authors']
|
108
|
+
hash['authors'].each do |item|
|
109
|
+
assert_kind_of Hash, item
|
110
|
+
end
|
111
|
+
|
112
|
+
json_str = r.dump_to_json
|
113
|
+
assert_kind_of String, json_str
|
114
|
+
|
115
|
+
r2 = ResultItem.load_json( json_str )
|
116
|
+
assert_kind_of Array, r2.authors
|
117
|
+
assert r2.authors.length == 1
|
118
|
+
|
119
|
+
au = r2.authors.first
|
120
|
+
assert_kind_of BentoSearch::Author, au
|
121
|
+
assert_equal "Jonathan", au.first
|
122
|
+
assert_equal "Rochkind", au.last
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_result_item_other_links
|
126
|
+
r = ResultItem.new(:title => "foo")
|
127
|
+
r.other_links << BentoSearch::Link.new(:url => "http://example.org")
|
128
|
+
|
129
|
+
r2 = ResultItem.load_json( r.dump_to_json )
|
130
|
+
assert_kind_of Array, r2.other_links
|
131
|
+
assert r2.other_links.length == 1
|
132
|
+
|
133
|
+
l = r2.other_links.first
|
134
|
+
assert_kind_of BentoSearch::Link, l
|
135
|
+
assert_equal "http://example.org", l.url
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_item_year_and_date
|
139
|
+
r = ResultItem.new(:title => "foo", :year => 1991, :publication_date => Date.new(1991, 5, 1))
|
140
|
+
|
141
|
+
r2 = ResultItem.load_json( r.dump_to_json )
|
142
|
+
|
143
|
+
assert_equal 1991, r2.year
|
144
|
+
assert_equal Date.new(1991, 5, 1), r2.publication_date
|
145
|
+
end
|
146
|
+
|
147
|
+
class Results < ActionController::TestCase
|
148
|
+
test "serialize" do
|
149
|
+
engine = MockEngine.new(:id => "foo",
|
150
|
+
:for_display => {:foo => "bar", :nested => {"one" => "two"}}
|
151
|
+
)
|
152
|
+
|
153
|
+
results = engine.search("foo")
|
154
|
+
|
155
|
+
assert_kind_of Hash, results.internal_state_hash
|
156
|
+
assert_equal "foo", results.internal_state_hash["engine_id"]
|
157
|
+
assert_kind_of Array, results.internal_state_hash["result_items"]
|
158
|
+
|
159
|
+
assert_kind_of String, results.dump_to_json
|
160
|
+
assert_equal results.internal_state_hash, JSON.parse(results.dump_to_json)
|
161
|
+
end
|
162
|
+
|
163
|
+
test "de-serialize with no engine ID" do
|
164
|
+
engine = MockEngine.new(
|
165
|
+
:for_display => {:foo => "bar", :nested => {"one" => "two"}}
|
166
|
+
)
|
167
|
+
results = engine.search("foo")
|
168
|
+
|
169
|
+
hash = results.internal_state_hash
|
170
|
+
restored = BentoSearch::Results.from_internal_state_hash(hash)
|
171
|
+
assert_kind_of BentoSearch::Results, restored
|
172
|
+
assert_equal results.size, restored.size
|
173
|
+
#assert_equal "foo", restored.engine_id
|
174
|
+
|
175
|
+
json_str = results.dump_to_json
|
176
|
+
assert_kind_of String, json_str
|
177
|
+
assert_kind_of BentoSearch::Results, BentoSearch::Results.load_json(json_str)
|
178
|
+
end
|
179
|
+
|
180
|
+
test "de-serialized can be configured for any engine" do
|
181
|
+
create_engine = MockEngine.new()
|
182
|
+
restore_engine = MockEngine.new(
|
183
|
+
:id => "MyMockEngine",
|
184
|
+
:for_display => {:foo => "bar", :nested => {"one" => "two"}, :decorator => "SomeDecorator"}
|
185
|
+
)
|
186
|
+
|
187
|
+
json = create_engine.search("foo").dump_to_json
|
188
|
+
|
189
|
+
restored = BentoSearch::Results.load_json(json)
|
190
|
+
restore_engine.fill_in_search_metadata_for(restored)
|
191
|
+
|
192
|
+
assert_equal "MyMockEngine", restored.engine_id
|
193
|
+
assert_equal restore_engine.configuration.for_display, restored.display_configuration
|
194
|
+
|
195
|
+
assert restored.length > 0
|
196
|
+
|
197
|
+
restored.each do |item|
|
198
|
+
assert_equal "MyMockEngine", item.engine_id
|
199
|
+
assert_equal restore_engine.configuration.for_display, item.display_configuration
|
200
|
+
assert_equal "SomeDecorator", item.decorator
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
class RegisteredEngineTest < ActionController::TestCase
|
205
|
+
def setup
|
206
|
+
BentoSearch.register_engine("mock") do |config|
|
207
|
+
config.engine = "MockEngine"
|
208
|
+
config.for_display = {:foo => "bar", :nested => {"one" => "two"}, :decorator => "SomeDecorator"}
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
def teardown
|
214
|
+
BentoSearch.reset_engine_registrations!
|
215
|
+
end
|
216
|
+
|
217
|
+
test "de-serializes with a registered engine ID, restoring context" do
|
218
|
+
mock_engine = BentoSearch.get_engine("mock")
|
219
|
+
results = mock_engine.search("query")
|
220
|
+
|
221
|
+
json_str = results.dump_to_json
|
222
|
+
assert_kind_of String, json_str
|
223
|
+
|
224
|
+
restored = BentoSearch::Results.load_json(json_str)
|
225
|
+
|
226
|
+
assert_kind_of BentoSearch::Results, restored
|
227
|
+
|
228
|
+
assert_equal "mock", restored.engine_id
|
229
|
+
assert_equal mock_engine.configuration.for_display, restored.display_configuration
|
230
|
+
|
231
|
+
assert restored.length > 0
|
232
|
+
|
233
|
+
restored.each do |item|
|
234
|
+
assert_equal "mock", item.engine_id
|
235
|
+
assert_equal mock_engine.configuration.for_display, item.display_configuration
|
236
|
+
assert_equal "SomeDecorator", item.decorator
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
end
|
@@ -4,33 +4,27 @@ http_interactions:
|
|
4
4
|
method: get
|
5
5
|
uri: http://www.journaltocs.ac.uk/api/journals/badissn?output=articles&user=nobody@example.com
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: UTF-8
|
8
8
|
string: ''
|
9
9
|
headers: {}
|
10
10
|
response:
|
11
11
|
status:
|
12
12
|
code: 200
|
13
|
-
message:
|
14
|
-
T0s=
|
13
|
+
message: OK
|
15
14
|
headers:
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
- !binary |-
|
27
|
-
MTIwMQ==
|
28
|
-
!binary "Q29udGVudC1UeXBl":
|
29
|
-
- !binary |-
|
30
|
-
YXBwbGljYXRpb24veG1sOyBjaGFyc2V0PXV0Zi04
|
15
|
+
Date:
|
16
|
+
- Tue, 01 Sep 2015 21:20:10 GMT
|
17
|
+
Server:
|
18
|
+
- Apache
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.3.3
|
21
|
+
Content-Length:
|
22
|
+
- '1189'
|
23
|
+
Content-Type:
|
24
|
+
- application/xml; charset=utf-8
|
31
25
|
body:
|
32
|
-
encoding:
|
33
|
-
string:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n
|
34
28
|
\ xmlns=\"http://purl.org/rss/1.0/\"\r\n xmlns:mn=\"http://usefulinc.com/rss/manifest/\"\r\n
|
35
29
|
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n\n <channel rdf:about=\"http://www.journaltocs.hw.ac.uk/api/journals\">\r\n
|
36
30
|
\ <title>JournalTOCs API - Found 0 journals for: badissn (0 articles)</title>\r\n
|
@@ -39,11 +33,11 @@ http_interactions:
|
|
39
33
|
for this journal. Please report to S.Chumbe@hw.ac.uk]]></description>\r\n
|
40
34
|
\ <dc:publisher>JournalTOCs API</dc:publisher>\r\n <dc:creator>JOURNALTOCS
|
41
35
|
API PROJECT</dc:creator>\r\n\t\t<dc:coverage>1</dc:coverage>\r\n <image
|
42
|
-
rdf:resource=\"http://www.journaltocs.
|
43
|
-
\ <items>\r\n <rdf:Seq>\r\n
|
44
|
-
\
|
36
|
+
rdf:resource=\"http://www.journaltocs.ac.uk/images/jtocslogo.gif\" />\r\n
|
37
|
+
\ <items>\r\n <rdf:Seq>\r\n </rdf:Seq>\r\n </items>\r\n </channel>\r\n
|
38
|
+
\ \r\n\t\r\n <rdf:Description rdf:ID=\"manifest\">\r\n <mn:channels>\r\n
|
45
39
|
\ <rdf:Seq>\r\n <rdf:li rdf:resource=\"http://www.journaltocs.hw.ac.uk/api/journals\"
|
46
40
|
/>\r\n </rdf:Seq>\r\n </mn:channels>\r\n </rdf:Description>\r\n\r\n</rdf:RDF>"
|
47
41
|
http_version:
|
48
|
-
recorded_at:
|
49
|
-
recorded_with: VCR 2.3
|
42
|
+
recorded_at: Tue, 01 Sep 2015 21:20:10 GMT
|
43
|
+
recorded_with: VCR 2.9.3
|
@@ -4,38 +4,31 @@ http_interactions:
|
|
4
4
|
method: get
|
5
5
|
uri: http://www.journaltocs.ac.uk/api/journals/1533290X?output=articles&user=unregistered@nowhere.com
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: UTF-8
|
8
8
|
string: ''
|
9
9
|
headers: {}
|
10
10
|
response:
|
11
11
|
status:
|
12
12
|
code: 401
|
13
|
-
message:
|
14
|
-
VW5hdXRob3JpemVk
|
13
|
+
message: Unauthorized
|
15
14
|
headers:
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
-
|
27
|
-
|
28
|
-
!binary "Q29ubmVjdGlvbg==":
|
29
|
-
- !binary |-
|
30
|
-
Y2xvc2U=
|
31
|
-
!binary "Q29udGVudC1UeXBl":
|
32
|
-
- !binary |-
|
33
|
-
dGV4dC94bWw7IGNoYXJzZXQ9dXRmLTg=
|
15
|
+
Date:
|
16
|
+
- Tue, 01 Sep 2015 21:20:10 GMT
|
17
|
+
Server:
|
18
|
+
- Apache
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.3.3
|
21
|
+
Content-Length:
|
22
|
+
- '237'
|
23
|
+
Connection:
|
24
|
+
- close
|
25
|
+
Content-Type:
|
26
|
+
- text/xml; charset=utf-8
|
34
27
|
body:
|
35
|
-
encoding:
|
36
|
-
string:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n\t<noticeCode>1</noticeCode>\n\t<noticeDescription>:-(
|
37
30
|
Sorry, your account is invalid. If you think it is my fault, pl let know by
|
38
|
-
email to: journaltocs@hw.ac.uk</noticeDescription>\
|
31
|
+
email to: journaltocs@hw.ac.uk</noticeDescription>\n</notice> "
|
39
32
|
http_version:
|
40
|
-
recorded_at:
|
41
|
-
recorded_with: VCR 2.3
|
33
|
+
recorded_at: Tue, 01 Sep 2015 21:20:10 GMT
|
34
|
+
recorded_with: VCR 2.9.3
|