blacklight 5.5.1 → 5.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +8 -16
- data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -1
- data/app/helpers/blacklight/url_helper_behavior.rb +5 -1
- data/app/views/catalog/_view_type_group.html.erb +1 -1
- data/blacklight.gemspec +2 -1
- data/gemfiles/rails3.gemfile +1 -1
- data/gemfiles/rails4.1.gemfile +1 -1
- data/gemfiles/rails4.gemfile +1 -1
- data/lib/blacklight/catalog.rb +0 -1
- data/lib/blacklight/solr/facet_paginator.rb +22 -10
- data/lib/generators/blacklight/install_generator.rb +1 -1
- data/spec/controllers/bookmarks_controller_spec.rb +6 -6
- data/spec/controllers/catalog_controller_spec.rb +48 -48
- data/spec/features/alternate_controller_spec.rb +3 -3
- data/spec/features/record_view_spec.rb +1 -1
- data/spec/features/search_filters_spec.rb +4 -4
- data/spec/features/search_results_spec.rb +12 -12
- data/spec/helpers/blacklight_helper_spec.rb +83 -83
- data/spec/helpers/catalog_helper_spec.rb +37 -37
- data/spec/helpers/configuration_helper_spec.rb +39 -39
- data/spec/helpers/facets_helper_spec.rb +37 -37
- data/spec/helpers/render_constraints_helper_spec.rb +6 -1
- data/spec/helpers/search_history_constraints_helper_spec.rb +9 -9
- data/spec/helpers/url_helper_spec.rb +49 -39
- data/spec/lib/blacklight/configurable_spec.rb +5 -5
- data/spec/lib/blacklight/configuration_spec.rb +8 -8
- data/spec/lib/blacklight/facet_paginator_spec.rb +25 -0
- data/spec/lib/blacklight/routes_spec.rb +4 -4
- data/spec/lib/blacklight/search_fields_spec.rb +3 -3
- data/spec/lib/blacklight/solr/document_spec.rb +2 -2
- data/spec/lib/blacklight/solr_helper_spec.rb +37 -37
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +1 -1
- data/spec/lib/blacklight/solr_response_spec.rb +31 -31
- data/spec/lib/document_presenter_spec.rb +41 -41
- data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
- data/spec/models/record_mailer_spec.rb +1 -1
- data/spec/models/search_spec.rb +1 -1
- data/spec/routing/catalog_routing_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/support/include_text.rb +2 -3
- data/spec/views/catalog/_constraints.html.erb_spec.rb +7 -7
- data/spec/views/catalog/_document.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_facets.html.erb_spec.rb +6 -6
- data/spec/views/catalog/_index_default.erb_spec.rb +10 -10
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +5 -5
- data/spec/views/catalog/_show_default.erb_spec.rb +10 -10
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +5 -5
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +4 -4
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +5 -2
- data/spec/views/catalog/facet.html.erb_spec.rb +5 -5
- data/spec/views/catalog/index.atom.builder_spec.rb +2 -2
- data/spec/views/catalog/index.html.erb_spec.rb +5 -5
- data/spec/views/catalog/show.html.erb_spec.rb +8 -8
- data/tasks/blacklight.rake +1 -2
- metadata +18 -4
@@ -22,71 +22,71 @@ describe Blacklight::DocumentPresenter do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
it "should check for an explicit value" do
|
25
|
-
document.
|
25
|
+
expect(document).to_not receive(:get).with('asdf', :sep => nil)
|
26
26
|
value = subject.render_index_field_value 'asdf', :value => 'asdf'
|
27
27
|
expect(value).to eq 'asdf'
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should check for a helper method to call" do
|
31
|
-
document.
|
32
|
-
request_context.
|
31
|
+
allow(document).to receive(:get).with('asdf', :sep => nil)
|
32
|
+
allow(request_context).to receive(:render_asdf_index_field).and_return('custom asdf value')
|
33
33
|
value = subject.render_index_field_value 'asdf'
|
34
34
|
expect(value).to eq 'custom asdf value'
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should check for a link_to_search" do
|
38
|
-
document.
|
39
|
-
request_context.
|
40
|
-
request_context.
|
41
|
-
request_context.
|
38
|
+
allow(document).to receive(:get).with('link_to_search_true', :sep => nil).and_return('x')
|
39
|
+
allow(request_context).to receive(:add_facet_params).and_return(:f => { :link_to_search_true => ['x'] })
|
40
|
+
allow(request_context).to receive(:search_action_path).with(:f => { :link_to_search_true => ['x'] }).and_return('/foo')
|
41
|
+
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
42
42
|
value = subject.render_index_field_value 'link_to_search_true'
|
43
43
|
expect(value).to eq 'bar'
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should check for a link_to_search with a field name" do
|
47
|
-
document.
|
48
|
-
request_context.
|
49
|
-
request_context.
|
50
|
-
request_context.
|
47
|
+
allow(document).to receive(:get).with('link_to_search_named', :sep => nil).and_return('x')
|
48
|
+
allow(request_context).to receive(:add_facet_params).and_return(:f => { :some_field => ['x'] })
|
49
|
+
allow(request_context).to receive(:search_action_path).with(:f => { :some_field => ['x'] }).and_return('/foo')
|
50
|
+
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
51
51
|
value = subject.render_index_field_value 'link_to_search_named'
|
52
52
|
expect(value).to eq 'bar'
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should gracefully handle when no highlight field is available" do
|
56
|
-
document.
|
57
|
-
document.
|
56
|
+
expect(document).to_not receive(:get)
|
57
|
+
allow(document).to receive(:has_highlight_field?).and_return(false)
|
58
58
|
value = subject.render_index_field_value 'highlight'
|
59
59
|
expect(value).to be_blank
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should check for a highlighted field" do
|
63
|
-
document.
|
64
|
-
document.
|
65
|
-
document.
|
63
|
+
expect(document).to_not receive(:get)
|
64
|
+
allow(document).to receive(:has_highlight_field?).and_return(true)
|
65
|
+
allow(document).to receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
|
66
66
|
value = subject.render_index_field_value 'highlight'
|
67
67
|
expect(value).to eq '<em>highlight</em>'
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should check the document field value" do
|
71
|
-
document.
|
71
|
+
allow(document).to receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
|
72
72
|
value = subject.render_index_field_value 'qwer'
|
73
73
|
expect(value).to eq 'document qwer value'
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should work with index fields that aren't explicitly defined" do
|
77
|
-
document.
|
77
|
+
allow(document).to receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
|
78
78
|
value = subject.render_index_field_value 'mnbv'
|
79
79
|
expect(value).to eq 'document mnbv value'
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should call an accessor on the solr document" do
|
83
|
-
document.
|
83
|
+
allow(document).to receive_messages(:solr_doc_accessor => "123")
|
84
84
|
value = subject.render_index_field_value 'solr_doc_accessor'
|
85
85
|
expect(value).to eq "123"
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should call an explicit accessor on the solr document" do
|
89
|
-
document.
|
89
|
+
allow(document).to receive_messages(:solr_doc_accessor => "123")
|
90
90
|
value = subject.render_index_field_value 'explicit_accessor'
|
91
91
|
expect(value).to eq "123"
|
92
92
|
end
|
@@ -114,77 +114,77 @@ describe Blacklight::DocumentPresenter do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should check for an explicit value" do
|
117
|
-
document.
|
118
|
-
request_context.
|
117
|
+
expect(document).to_not receive(:get).with('asdf', :sep => nil)
|
118
|
+
expect(request_context).to_not receive(:render_asdf_document_show_field)
|
119
119
|
value = subject.render_document_show_field_value 'asdf', :value => 'val1'
|
120
120
|
expect(value).to eq 'val1'
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should check for a helper method to call" do
|
124
|
-
document.
|
125
|
-
request_context.
|
124
|
+
allow(document).to receive(:get).with('asdf', :sep => nil)
|
125
|
+
allow(request_context).to receive(:render_asdf_document_show_field).and_return('custom asdf value')
|
126
126
|
value = subject.render_document_show_field_value 'asdf'
|
127
127
|
expect(value).to eq 'custom asdf value'
|
128
128
|
end
|
129
129
|
|
130
130
|
it "should check for a link_to_search" do
|
131
|
-
document.
|
132
|
-
request_context.
|
133
|
-
request_context.
|
131
|
+
allow(document).to receive(:get).with('link_to_search_true', :sep => nil).and_return('x')
|
132
|
+
allow(request_context).to receive(:search_action_path).with('').and_return('/foo')
|
133
|
+
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
134
134
|
value = subject.render_document_show_field_value 'link_to_search_true'
|
135
135
|
expect(value).to eq 'bar'
|
136
136
|
end
|
137
137
|
|
138
138
|
it "should check for a link_to_search with a field name" do
|
139
|
-
document.
|
140
|
-
request_context.
|
141
|
-
request_context.
|
139
|
+
allow(document).to receive(:get).with('link_to_search_named', :sep => nil).and_return('x')
|
140
|
+
allow(request_context).to receive(:search_action_path).with('').and_return('/foo')
|
141
|
+
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
142
142
|
value = subject.render_document_show_field_value 'link_to_search_named'
|
143
143
|
expect(value).to eq 'bar'
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should gracefully handle when no highlight field is available" do
|
147
|
-
document.
|
148
|
-
document.
|
147
|
+
expect(document).to_not receive(:get)
|
148
|
+
allow(document).to receive(:has_highlight_field?).and_return(false)
|
149
149
|
value = subject.render_document_show_field_value 'highlight'
|
150
150
|
expect(value).to be_blank
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should check for a highlighted field" do
|
154
|
-
document.
|
155
|
-
document.
|
156
|
-
document.
|
154
|
+
expect(document).to_not receive(:get)
|
155
|
+
allow(document).to receive(:has_highlight_field?).and_return(true)
|
156
|
+
allow(document).to receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
|
157
157
|
value = subject.render_document_show_field_value 'highlight'
|
158
158
|
expect(value).to eq '<em>highlight</em>'
|
159
159
|
end
|
160
160
|
|
161
161
|
|
162
162
|
it "should check the document field value" do
|
163
|
-
document.
|
163
|
+
allow(document).to receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
|
164
164
|
value = subject.render_document_show_field_value 'qwer'
|
165
165
|
expect(value).to eq 'document qwer value'
|
166
166
|
end
|
167
167
|
|
168
168
|
it "should work with show fields that aren't explicitly defined" do
|
169
|
-
document.
|
169
|
+
allow(document).to receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
|
170
170
|
value = subject.render_document_show_field_value 'mnbv'
|
171
171
|
expect(value).to eq 'document mnbv value'
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should call an accessor on the solr document" do
|
175
|
-
document.
|
175
|
+
allow(document).to receive_messages(:solr_doc_accessor => "123")
|
176
176
|
value = subject.render_document_show_field_value 'solr_doc_accessor'
|
177
177
|
expect(value).to eq "123"
|
178
178
|
end
|
179
179
|
|
180
180
|
it "should call an explicit accessor on the solr document" do
|
181
|
-
document.
|
181
|
+
allow(document).to receive_messages(:solr_doc_accessor => "123")
|
182
182
|
value = subject.render_document_show_field_value 'explicit_accessor'
|
183
183
|
expect(value).to eq "123"
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should call an explicit array-style accessor on the solr document" do
|
187
|
-
document.
|
187
|
+
allow(document).to receive_messages(:solr_doc_accessor => double(:some_method => "123"))
|
188
188
|
value = subject.render_document_show_field_value 'explicit_array_accessor'
|
189
189
|
expect(value).to eq "123"
|
190
190
|
end
|
@@ -201,7 +201,7 @@ describe Blacklight::DocumentPresenter do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
it "should join values using the field_value_separator" do
|
204
|
-
subject.
|
204
|
+
allow(subject).to receive(:field_value_separator).and_return(" -- ")
|
205
205
|
expect(subject.render_field_value(['a', 'b'])).to eq "a -- b"
|
206
206
|
end
|
207
207
|
|
@@ -14,7 +14,7 @@ describe "blacklight:delete_old_searches" do
|
|
14
14
|
|
15
15
|
it "should call Search.delete_old_searches" do
|
16
16
|
days_old = 7
|
17
|
-
Search.
|
17
|
+
allow(Search).to receive(:delete_old_searches).with(days_old)
|
18
18
|
@rake[@task_name].invoke(days_old)
|
19
19
|
end
|
20
20
|
|
@@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
4
4
|
|
5
5
|
describe RecordMailer do
|
6
6
|
before(:each) do
|
7
|
-
RecordMailer.
|
7
|
+
allow(RecordMailer).to receive(:default) { { :from => 'no-reply@projectblacklight.org' } }
|
8
8
|
SolrDocument.use_extension( Blacklight::Solr::Document::Email )
|
9
9
|
SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
|
10
10
|
document = SolrDocument.new({:id=>"123456", :format=>["book"], :title_display => "The horn", :language_facet => "English", :author_display => "Janetzky, Kurt"})
|
data/spec/models/search_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Search do
|
|
14
14
|
it "should return a Hash as the value" do
|
15
15
|
@search.query_params = @query_params
|
16
16
|
assert @search.save
|
17
|
-
Search.find(@search.id).query_params.
|
17
|
+
expect(Search.find(@search.id).query_params).to eq @query_params
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -34,7 +34,7 @@ describe "Routing" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should route url-like ids" do
|
37
|
-
|
37
|
+
skip "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
|
38
38
|
expect(:get => catalog_path(SolrDocument.new(:id => 'http://example.com'))).to route_to(:controller => 'catalog', :action => 'show', :id => 'http://example.com')
|
39
39
|
end
|
40
40
|
|
@@ -47,7 +47,7 @@ describe "Routing" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should route ids with a literal '/" do
|
50
|
-
|
50
|
+
skip "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
|
51
51
|
expect(:get => catalog_path(SolrDocument.new(:id => 'and/or'))).to route_to(:controller => 'catalog', :action => 'show', :id => 'and/or')
|
52
52
|
end
|
53
53
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,14 +8,13 @@ module RSpec::Rails
|
|
8
8
|
@content.include?(text)
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
failure_message do |text|
|
12
12
|
"expected '#{@content}' to contain '#{text}'"
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
failure_message_when_negated do |text|
|
16
16
|
"expected #{@content} to not contain '#{text}'"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
@@ -8,25 +8,25 @@ describe "catalog/constraints" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should render nothing if no constraints are set" do
|
11
|
-
view.
|
11
|
+
allow(view).to receive_messages(query_has_constraints?: false)
|
12
12
|
render partial: "catalog/constraints"
|
13
13
|
expect(rendered).to be_empty
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should render a start over link" do
|
17
|
-
view.
|
18
|
-
view.
|
19
|
-
view.
|
17
|
+
allow(view).to receive(:search_action_path).with({}).and_return('http://xyz')
|
18
|
+
allow(view).to receive_messages(query_has_constraints?: true)
|
19
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
20
20
|
render partial: "catalog/constraints"
|
21
21
|
expect(rendered).to have_selector("#startOverLink")
|
22
22
|
expect(rendered).to have_link("Start Over", :href => 'http://xyz')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should render a start over link with the current view type" do
|
26
|
-
view.
|
27
|
-
view.
|
26
|
+
allow(view).to receive(:search_action_path).with(view: :xyz).and_return('http://xyz?view=xyz')
|
27
|
+
allow(view).to receive_messages(query_has_constraints?: true)
|
28
28
|
params[:view] = 'xyz'
|
29
|
-
view.
|
29
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
30
30
|
render partial: "catalog/constraints"
|
31
31
|
expect(rendered).to have_selector("#startOverLink")
|
32
32
|
expect(rendered).to have_link("Start Over", :href => 'http://xyz?view=xyz')
|
@@ -10,8 +10,8 @@ describe "catalog/_document" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should render the header, thumbnail and index by default" do
|
13
|
-
view.
|
14
|
-
view.
|
13
|
+
allow(view).to receive(:render_grouped_response?).and_return(false)
|
14
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
15
15
|
stub_template "catalog/_index_header_default.html.erb" => "document_header"
|
16
16
|
stub_template "catalog/_thumbnail_default.html.erb" => "thumbnail_default"
|
17
17
|
stub_template "catalog/_index_default.html.erb" => "index_default"
|
@@ -25,8 +25,8 @@ describe "catalog/_document" do
|
|
25
25
|
|
26
26
|
|
27
27
|
it "should use the index.partials parameter to determine the partials to render" do
|
28
|
-
view.
|
29
|
-
view.
|
28
|
+
allow(view).to receive(:render_grouped_response?).and_return(false)
|
29
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
30
30
|
blacklight_config.index.partials = ['a', 'b', 'c']
|
31
31
|
stub_template "catalog/_a_default.html.erb" => "a_partial"
|
32
32
|
stub_template "catalog/_b_default.html.erb" => "b_partial"
|
@@ -13,7 +13,7 @@ describe "catalog/facet_layout" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
before do
|
16
|
-
view.
|
16
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should have a facet-specific class" do
|
@@ -33,7 +33,7 @@ describe "catalog/facet_layout" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should be configured to be open by default" do
|
36
|
-
facet_field.
|
36
|
+
allow(facet_field).to receive_messages(collapse: false)
|
37
37
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
38
38
|
expect(rendered).to_not have_selector '.panel-heading.collapsed'
|
39
39
|
expect(rendered).to have_selector '.in .panel-body'
|
@@ -4,15 +4,15 @@ describe "catalog/_facets" do
|
|
4
4
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
5
|
|
6
6
|
before do
|
7
|
-
view.
|
8
|
-
view.
|
7
|
+
allow(view).to receive_messages(blacklight_config: blacklight_config)
|
8
|
+
allow(view).to receive(:search_action_path) do |*args|
|
9
9
|
catalog_index_url *args
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
context "without any facet fields" do
|
14
14
|
it "should not have a header if no facets are displayed" do
|
15
|
-
view.
|
15
|
+
allow(view).to receive_messages(:render_facet_partials => '')
|
16
16
|
render
|
17
17
|
expect(rendered).to_not have_selector('h4')
|
18
18
|
end
|
@@ -27,15 +27,15 @@ describe "catalog/_facets" do
|
|
27
27
|
blacklight_config.facet_fields['facet_field_1'] = facet_field
|
28
28
|
|
29
29
|
@mock_display_facet_1 = double(:name => 'facet_field_1', sort: nil, offset: nil, :items => [Blacklight::SolrResponse::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
|
30
|
-
view.
|
30
|
+
allow(view).to receive_messages(:facet_field_names => [:facet_field_1],
|
31
31
|
:facet_limit_for => 10 )
|
32
32
|
|
33
33
|
@response = double()
|
34
|
-
@response.
|
34
|
+
allow(@response).to receive(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should have a header" do
|
38
|
-
view.
|
38
|
+
allow(view).to receive_messages(:render_facet_partials => '')
|
39
39
|
render
|
40
40
|
expect(rendered).to have_selector('h4')
|
41
41
|
end
|
@@ -21,24 +21,24 @@ describe "/catalog/_index_default.erb" do
|
|
21
21
|
@fname_4 = "four_field"
|
22
22
|
|
23
23
|
@document = double("solr_doc")
|
24
|
-
@document.
|
25
|
-
@document.
|
26
|
-
@document.
|
27
|
-
@document.
|
24
|
+
allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
|
25
|
+
allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
|
26
|
+
allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
|
27
|
+
allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
|
28
28
|
|
29
|
-
@document.
|
30
|
-
@document.
|
31
|
-
@document.
|
32
|
-
@document.
|
29
|
+
allow(@document).to receive(:has?).with(@fname_1).and_return(true)
|
30
|
+
allow(@document).to receive(:has?).with(@fname_2).and_return(true)
|
31
|
+
allow(@document).to receive(:has?).with(@fname_3).and_return(false)
|
32
|
+
allow(@document).to receive(:has?).with(@fname_4).and_return(true)
|
33
33
|
|
34
34
|
# cover any remaining fields in initalizer
|
35
|
-
@document.
|
35
|
+
allow(@document).to receive(:[])
|
36
36
|
|
37
37
|
@flabel_1 = "One:"
|
38
38
|
@flabel_3 = "Three:"
|
39
39
|
@flabel_4 = "Four:"
|
40
40
|
|
41
|
-
view.
|
41
|
+
allow(view).to receive(:blacklight_config).and_return(@config)
|
42
42
|
assigns[:document] = @document
|
43
43
|
@rendered = view.render_document_partial @document, :index
|
44
44
|
end
|
@@ -11,11 +11,11 @@ describe "catalog/_index_header_default" do
|
|
11
11
|
|
12
12
|
it "should render the document header" do
|
13
13
|
assign :response, double(:params => {})
|
14
|
-
view.
|
15
|
-
view.
|
16
|
-
view.
|
17
|
-
view.
|
18
|
-
view.
|
14
|
+
allow(view).to receive(:current_search_session).and_return nil
|
15
|
+
allow(view).to receive(:search_session).and_return({})
|
16
|
+
allow(view).to receive(:render_grouped_response?).and_return false
|
17
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
18
|
+
allow(view).to receive(:render_bookmarks_control?).and_return false
|
19
19
|
render :partial => "catalog/index_header_default", :locals => {:document => document, :document_counter => 1}
|
20
20
|
expect(rendered).to have_selector('.document-counter', text: "2")
|
21
21
|
end
|
@@ -23,24 +23,24 @@ describe "/catalog/_show_default.html.erb" do
|
|
23
23
|
@fname_4 = "four_field"
|
24
24
|
|
25
25
|
@document = double("solr_doc")
|
26
|
-
@document.
|
27
|
-
@document.
|
28
|
-
@document.
|
29
|
-
@document.
|
26
|
+
allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
|
27
|
+
allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
|
28
|
+
allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
|
29
|
+
allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
|
30
30
|
|
31
|
-
@document.
|
32
|
-
@document.
|
33
|
-
@document.
|
34
|
-
@document.
|
31
|
+
allow(@document).to receive(:has?).with(@fname_1).and_return(true)
|
32
|
+
allow(@document).to receive(:has?).with(@fname_2).and_return(true)
|
33
|
+
allow(@document).to receive(:has?).with(@fname_3).and_return(false)
|
34
|
+
allow(@document).to receive(:has?).with(@fname_4).and_return(true)
|
35
35
|
|
36
36
|
# cover any remaining fields in initalizer
|
37
|
-
@document.
|
37
|
+
allow(@document).to receive(:[])
|
38
38
|
|
39
39
|
@flabel_1 = "One:"
|
40
40
|
@flabel_3 = "Two:"
|
41
41
|
@flabel_4 = "Four:"
|
42
42
|
|
43
|
-
view.
|
43
|
+
allow(view).to receive(:blacklight_config).and_return(@config)
|
44
44
|
assigns[:document] = @document
|
45
45
|
@rendered = view.render_document_partial @document, :show
|
46
46
|
end
|