blacklight 4.3.0 → 4.4.0
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/.gitignore +1 -0
- data/.travis.yml +0 -6
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/autofocus.js +16 -0
- data/app/assets/javascripts/blacklight/blacklight.js +1 -0
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
- data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
- data/app/assets/javascripts/blacklight/core.js +24 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
- data/app/assets/javascripts/blacklight/search_context.js +1 -1
- data/app/assets/javascripts/blacklight/select_submit.js +1 -1
- data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
- data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
- data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
- data/app/models/record_mailer.rb +1 -16
- data/app/views/bookmarks/index.html.erb +2 -0
- data/app/views/catalog/_bookmark_control.html.erb +3 -4
- data/app/views/catalog/_document.html.erb +2 -1
- data/app/views/catalog/_document_header.html.erb +6 -3
- data/app/views/catalog/_email_form.html.erb +0 -7
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_group_default.html.erb +12 -0
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
- data/app/views/catalog/_paginate_compact.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +1 -21
- data/app/views/catalog/_thumbnail_default.html.erb +5 -0
- data/app/views/catalog/email_sent.html.erb +9 -0
- data/app/views/catalog/index.atom.builder +7 -8
- data/app/views/catalog/index.html.erb +6 -3
- data/app/views/catalog/librarian_view.html.erb +1 -1
- data/app/views/catalog/sms_sent.html.erb +9 -0
- data/app/views/feedback/complete.html.erb +2 -0
- data/app/views/feedback/show.html.erb +7 -5
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -2
- data/app/views/saved_searches/index.html.erb +2 -0
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/locales/blacklight.en.yml +11 -0
- data/config/locales/blacklight.fr.yml +15 -1
- data/gemfiles/rails3.gemfile +7 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/lib/blacklight.rb +1 -0
- data/lib/blacklight/catalog.rb +101 -56
- data/lib/blacklight/configuration.rb +1 -1
- data/lib/blacklight/controller.rb +7 -4
- data/lib/blacklight/facet.rb +79 -0
- data/lib/blacklight/routes.rb +0 -1
- data/lib/blacklight/solr/document.rb +4 -0
- data/lib/blacklight/solr/document/marc_export.rb +1 -1
- data/lib/blacklight/solr_helper.rb +39 -8
- data/lib/blacklight/solr_response.rb +35 -3
- data/lib/blacklight/solr_response/facets.rb +4 -0
- data/lib/blacklight/solr_response/group.rb +33 -0
- data/lib/blacklight/solr_response/group_response.rb +49 -0
- data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
- data/lib/blacklight/user.rb +30 -32
- data/lib/generators/blacklight/assets_generator.rb +3 -1
- data/lib/generators/blacklight/blacklight_generator.rb +28 -125
- data/lib/generators/blacklight/marc_generator.rb +66 -0
- data/lib/generators/blacklight/models_generator.rb +113 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
- data/lib/generators/blacklight/templates/config/solr.yml +0 -2
- data/lib/generators/blacklight/templates/solr_document.rb +1 -13
- data/lib/railties/all_tests.rake +5 -8
- data/spec/controllers/catalog_controller_spec.rb +185 -113
- data/spec/features/alternate_controller_spec.rb +34 -0
- data/spec/features/bookmarks_spec.rb +58 -0
- data/spec/features/did_you_mean_spec.rb +135 -0
- data/spec/features/librarian_view_spec.rb +13 -0
- data/spec/features/record_view_spec.rb +37 -0
- data/spec/features/saved_searches_spec.rb +47 -0
- data/spec/features/search_filters_spec.rb +137 -0
- data/spec/features/search_history_spec.rb +75 -0
- data/spec/features/search_pagination_spec.rb +91 -0
- data/spec/features/search_results_spec.rb +68 -0
- data/spec/features/search_sort_spec.rb +20 -0
- data/spec/features/search_spec.rb +108 -0
- data/spec/helpers/blacklight_helper_spec.rb +45 -2
- data/spec/helpers/catalog_helper_spec.rb +134 -1
- data/spec/helpers/facets_helper_spec.rb +8 -0
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
- data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
- data/spec/lib/blacklight_solr_response_spec.rb +11 -5
- data/spec/lib/blacklight_user_spec.rb +22 -41
- data/spec/lib/solr_helper_spec.rb +73 -1
- data/spec/models/record_mailer_spec.rb +3 -3
- data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/features.rb +7 -0
- data/spec/support/features/session_helpers.rb +22 -0
- data/spec/test_app_templates/Gemfile.extra +0 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
- data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
- data/tasks/blacklight.rake +0 -10
- metadata +49 -58
- data/features/bookmarks.feature +0 -68
- data/features/did_you_mean.feature +0 -123
- data/features/librarian_view.feature +0 -18
- data/features/record_view.feature +0 -40
- data/features/saved_searches.feature +0 -49
- data/features/search.feature +0 -83
- data/features/search_filters.feature +0 -119
- data/features/search_history.feature +0 -85
- data/features/search_pagination.feature +0 -53
- data/features/search_results.feature +0 -61
- data/features/search_sort.feature +0 -27
- data/features/step_definitions/bookmarks_steps.rb +0 -6
- data/features/step_definitions/error_steps.rb +0 -5
- data/features/step_definitions/general_steps.rb +0 -50
- data/features/step_definitions/record_view_steps.rb +0 -12
- data/features/step_definitions/saved_searches_steps.rb +0 -19
- data/features/step_definitions/search_facets_steps.rb +0 -29
- data/features/step_definitions/search_history_steps.rb +0 -9
- data/features/step_definitions/search_pagination_steps.rb +0 -29
- data/features/step_definitions/search_result_steps.rb +0 -115
- data/features/step_definitions/search_steps.rb +0 -118
- data/features/step_definitions/user_steps.rb +0 -5
- data/features/step_definitions/web_steps.rb +0 -217
- data/features/support/env.rb +0 -65
- data/features/support/paths.rb +0 -48
- data/features/support/selectors.rb +0 -40
- data/lib/railties/blacklight_cucumber.rake +0 -126
- data/lib/solrmarc.log.1 +0 -854
|
@@ -21,121 +21,141 @@ describe CatalogController do
|
|
|
21
21
|
@controller.instance_variable_get("@response")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
describe "with format :html" do
|
|
25
|
+
it "should have no search history if no search criteria" do
|
|
26
|
+
controller.should_receive(:get_search_results)
|
|
27
|
+
session[:history] = []
|
|
28
|
+
get :index
|
|
29
|
+
session[:history].length.should == 0
|
|
30
|
+
end
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
# check each user manipulated parameter
|
|
33
|
+
it "should have docs and facets for query with results", :integration => true do
|
|
34
|
+
get :index, :q => @user_query
|
|
35
|
+
assigns_response.docs.size.should > 1
|
|
36
|
+
assert_facets_have_values(assigns_response.facets)
|
|
37
|
+
end
|
|
38
|
+
it "should have docs and facets for existing facet value", :integration => true do
|
|
39
|
+
get :index, :f => @facet_query
|
|
40
|
+
assigns_response.docs.size.should > 1
|
|
41
|
+
assert_facets_have_values(assigns_response.facets)
|
|
42
|
+
end
|
|
43
|
+
it "should have docs and facets for non-default results per page", :integration => true do
|
|
44
|
+
num_per_page = 7
|
|
45
|
+
get :index, :per_page => num_per_page
|
|
46
|
+
assigns_response.docs.size.should == num_per_page
|
|
47
|
+
assert_facets_have_values(assigns_response.facets)
|
|
48
|
+
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
it "should have docs and facets for second page", :integration => true do
|
|
51
|
+
page = 2
|
|
52
|
+
get :index, :page => page
|
|
53
|
+
assigns_response.docs.size.should > 1
|
|
54
|
+
assigns_response.params[:start].to_i.should == (page-1) * @controller.blacklight_config[:default_solr_params][:rows]
|
|
55
|
+
assert_facets_have_values(assigns_response.facets)
|
|
56
|
+
end
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
it "should have no docs or facet values for query without results", :integration => true do
|
|
59
|
+
get :index, :q => @no_docs_query
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
assigns_response.docs.size.should == 0
|
|
62
|
+
assigns_response.facets.each do |facet|
|
|
63
|
+
facet.items.size.should == 0
|
|
64
|
+
end
|
|
63
65
|
end
|
|
64
|
-
end
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe "session" do
|
|
72
|
-
before do
|
|
73
|
-
controller.stub(:get_search_results)
|
|
67
|
+
it "should have a spelling suggestion for an appropriately poor query", :integration => true do
|
|
68
|
+
get :index, :q => 'boo'
|
|
69
|
+
assigns_response.spelling.words.should_not be_nil
|
|
74
70
|
end
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
|
|
72
|
+
describe "session" do
|
|
73
|
+
before do
|
|
74
|
+
controller.stub(:get_search_results)
|
|
75
|
+
end
|
|
76
|
+
it "should include :search key with hash" do
|
|
77
|
+
get :index
|
|
78
|
+
session[:search].should_not be_nil
|
|
79
|
+
session[:search].should be_kind_of(Hash)
|
|
80
|
+
end
|
|
81
|
+
it "should include search hash with key :q" do
|
|
82
|
+
get :index, :q => @user_query
|
|
83
|
+
session[:search].should_not be_nil
|
|
84
|
+
session[:search].keys.should include(:q)
|
|
85
|
+
session[:search][:q].should == @user_query
|
|
86
|
+
end
|
|
87
|
+
it "should include search hash with key :f" do
|
|
88
|
+
get :index, :f => @facet_query
|
|
89
|
+
session[:search].should_not be_nil
|
|
90
|
+
session[:search].keys.should include(:f)
|
|
91
|
+
session[:search][:f].should == @facet_query
|
|
92
|
+
end
|
|
93
|
+
it "should include search hash with key :per_page" do
|
|
94
|
+
get :index, :per_page => 10
|
|
95
|
+
session[:search].should_not be_nil
|
|
96
|
+
session[:search].keys.should include(:per_page)
|
|
97
|
+
session[:search][:per_page].should == "10"
|
|
98
|
+
end
|
|
99
|
+
it "should include search hash with key :page" do
|
|
100
|
+
get :index, :page => 2
|
|
101
|
+
session[:search].should_not be_nil
|
|
102
|
+
session[:search].keys.should include(:page)
|
|
103
|
+
session[:search][:page].should == "2"
|
|
104
|
+
end
|
|
105
|
+
it "should include search hash with random key" do
|
|
106
|
+
# cause a plugin might add an unpredictable one, we want to preserve it.
|
|
107
|
+
get :index, :some_weird_key => "value"
|
|
108
|
+
session[:search].should_not be_nil
|
|
109
|
+
session[:search].keys.should include(:some_weird_key)
|
|
110
|
+
session[:search][:some_weird_key].should == "value"
|
|
111
|
+
end
|
|
79
112
|
end
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
|
|
114
|
+
# check with no user manipulation
|
|
115
|
+
describe "for default query" do
|
|
116
|
+
it "should get documents when no query", :integration => true do
|
|
117
|
+
get :index
|
|
118
|
+
assigns_response.docs.size.should > 1
|
|
119
|
+
end
|
|
120
|
+
it "should get facets when no query", :integration => true do
|
|
121
|
+
get :index
|
|
122
|
+
assert_facets_have_values(assigns_response.facets)
|
|
123
|
+
end
|
|
85
124
|
end
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
session[:search].keys.should include(:f)
|
|
90
|
-
session[:search][:f].should == @facet_query
|
|
91
|
-
end
|
|
92
|
-
it "should include search hash with key :per_page" do
|
|
93
|
-
get :index, :per_page => 10
|
|
94
|
-
session[:search].should_not be_nil
|
|
95
|
-
session[:search].keys.should include(:per_page)
|
|
96
|
-
session[:search][:per_page].should == "10"
|
|
97
|
-
end
|
|
98
|
-
it "should include search hash with key :page" do
|
|
99
|
-
get :index, :page => 2
|
|
100
|
-
session[:search].should_not be_nil
|
|
101
|
-
session[:search].keys.should include(:page)
|
|
102
|
-
session[:search][:page].should == "2"
|
|
103
|
-
end
|
|
104
|
-
it "should include search hash with random key" do
|
|
105
|
-
# cause a plugin might add an unpredictable one, we want to preserve it.
|
|
106
|
-
get :index, :some_weird_key => "value"
|
|
107
|
-
session[:search].should_not be_nil
|
|
108
|
-
session[:search].keys.should include(:some_weird_key)
|
|
109
|
-
session[:search][:some_weird_key].should == "value"
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# check with no user manipulation
|
|
114
|
-
describe "for default query" do
|
|
115
|
-
it "should get documents when no query", :integration => true do
|
|
125
|
+
|
|
126
|
+
it "should render index.html.erb" do
|
|
127
|
+
controller.stub(:get_search_results)
|
|
116
128
|
get :index
|
|
117
|
-
|
|
129
|
+
response.should render_template(:index)
|
|
118
130
|
end
|
|
119
|
-
|
|
131
|
+
|
|
132
|
+
# NOTE: status code is always 200 in isolation mode ...
|
|
133
|
+
it "HTTP status code for GET should be 200", :integration => true do
|
|
120
134
|
get :index
|
|
121
|
-
|
|
135
|
+
response.should be_success
|
|
122
136
|
end
|
|
123
137
|
end
|
|
124
138
|
|
|
125
|
-
|
|
126
|
-
get
|
|
127
|
-
|
|
139
|
+
describe "with format :rss" do
|
|
140
|
+
it "should get the feed", :integration => true do
|
|
141
|
+
get :index, :format => 'rss'
|
|
142
|
+
response.should be_success
|
|
143
|
+
end
|
|
128
144
|
end
|
|
129
145
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
describe "with format :json" do
|
|
147
|
+
it "should get the feed" do
|
|
148
|
+
get :index, :format => 'json'
|
|
149
|
+
response.should be_success
|
|
150
|
+
json = JSON.parse response.body
|
|
151
|
+
json["response"]["pages"]["total_count"].should == 30
|
|
152
|
+
json["response"]["pages"]["current_page"].should == 1
|
|
153
|
+
json["response"]["pages"]["total_pages"].should == 3
|
|
154
|
+
json["response"]["docs"].size.should == 10
|
|
155
|
+
json["response"]["docs"].first.keys.should == ["published_display", "author_display", "lc_callnum_display", "pub_date", "subtitle_display", "format", "material_type_display", "title_display", "id", "subject_topic_facet", "language_facet", "score"]
|
|
156
|
+
json["response"]["facets"].length.should == 9
|
|
157
|
+
json["response"]["facets"].first.should == {"name"=>"format", "items"=>[{"value"=>"Book", "hits"=>30}]}
|
|
158
|
+
end
|
|
139
159
|
end
|
|
140
160
|
|
|
141
161
|
end # describe index action
|
|
@@ -159,9 +179,20 @@ describe CatalogController do
|
|
|
159
179
|
|
|
160
180
|
doc_id = '2007020969'
|
|
161
181
|
|
|
162
|
-
|
|
163
|
-
get
|
|
164
|
-
|
|
182
|
+
describe "with format :html" do
|
|
183
|
+
it "should get document", :integration => true do
|
|
184
|
+
get :show, :id => doc_id
|
|
185
|
+
assigns[:document].should_not be_nil
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
describe "with format :json" do
|
|
190
|
+
it "should get the feed" do
|
|
191
|
+
get :show, id: doc_id, format: 'json'
|
|
192
|
+
response.should be_success
|
|
193
|
+
json = JSON.parse response.body
|
|
194
|
+
json["response"]["document"].keys.should == ["author_t", "opensearch_display", "marc_display", "published_display", "author_display", "lc_callnum_display", "title_t", "pub_date", "pub_date_sort", "subtitle_display", "format", "url_suppl_display", "material_type_display", "title_display", "subject_addl_t", "subject_t", "isbn_t", "id", "title_addl_t", "subject_geo_facet", "subject_topic_facet", "author_addl_t", "language_facet", "subtitle_t", "timestamp"]
|
|
195
|
+
end
|
|
165
196
|
end
|
|
166
197
|
|
|
167
198
|
describe "previous/next documents" do
|
|
@@ -278,21 +309,22 @@ describe CatalogController do
|
|
|
278
309
|
|
|
279
310
|
|
|
280
311
|
after(:each) do
|
|
281
|
-
|
|
312
|
+
# remove the fake extension
|
|
313
|
+
SolrDocument.registered_extensions.pop
|
|
282
314
|
end
|
|
283
315
|
end # dynamic export formats
|
|
284
316
|
|
|
285
317
|
end # describe show action
|
|
286
318
|
|
|
287
319
|
describe "opensearch" do
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
320
|
+
before do
|
|
321
|
+
@mock_response = double()
|
|
322
|
+
@mock_document = double()
|
|
323
|
+
@mock_response.stub(:docs => [{ :id => 'my_fake_doc' }, { :id => 'my_other_doc'}])
|
|
324
|
+
@mock_document = double()
|
|
325
|
+
controller.stub(:find => @mock_response,
|
|
326
|
+
:get_single_doc_via_search => @mock_document)
|
|
327
|
+
end
|
|
296
328
|
it "should return an opensearch description" do
|
|
297
329
|
get :opensearch, :format => 'xml'
|
|
298
330
|
response.should be_success
|
|
@@ -336,6 +368,12 @@ describe CatalogController do
|
|
|
336
368
|
request.flash[:error].should be_nil
|
|
337
369
|
request.should redirect_to(catalog_path(doc_id))
|
|
338
370
|
end
|
|
371
|
+
|
|
372
|
+
it "should render email_sent for XHR requests" do
|
|
373
|
+
xhr :post, :email, :id => doc_id, :to => 'test_email@projectblacklight.org'
|
|
374
|
+
expect(request).to render_template 'email_sent'
|
|
375
|
+
expect(request.flash[:success]).to eq "Email Sent"
|
|
376
|
+
end
|
|
339
377
|
end
|
|
340
378
|
describe "sms" do
|
|
341
379
|
it "should give error if no phone number is given" do
|
|
@@ -347,19 +385,29 @@ describe CatalogController do
|
|
|
347
385
|
request.flash[:error].should == "You must select a carrier"
|
|
348
386
|
end
|
|
349
387
|
it "should give an error when the phone number is not 10 digits" do
|
|
350
|
-
post :sms, :id => doc_id, :to => '555555555', :carrier => 'att'
|
|
388
|
+
post :sms, :id => doc_id, :to => '555555555', :carrier => 'txt.att.net'
|
|
351
389
|
request.flash[:error].should == "You must enter a valid 10 digit phone number"
|
|
352
390
|
end
|
|
391
|
+
it "should give an error when the carrier is not in our list of carriers" do
|
|
392
|
+
post :sms, :id => doc_id, :to => '5555555555', :carrier => 'no-such-carrier'
|
|
393
|
+
request.flash[:error].should == "You must enter a valid carrier"
|
|
394
|
+
end
|
|
353
395
|
it "should allow punctuation in phone number" do
|
|
354
|
-
post :sms, :id => doc_id, :to => '(555) 555-5555', :carrier => 'att'
|
|
396
|
+
post :sms, :id => doc_id, :to => '(555) 555-5555', :carrier => 'txt.att.net'
|
|
355
397
|
request.flash[:error].should be_nil
|
|
356
398
|
request.should redirect_to(catalog_path(doc_id))
|
|
357
399
|
end
|
|
358
400
|
it "should redirect back to the record upon success" do
|
|
359
|
-
post :sms, :id => doc_id, :to => '5555555555', :carrier => 'att'
|
|
401
|
+
post :sms, :id => doc_id, :to => '5555555555', :carrier => 'txt.att.net'
|
|
360
402
|
request.flash[:error].should be_nil
|
|
361
403
|
request.should redirect_to(catalog_path(doc_id))
|
|
362
404
|
end
|
|
405
|
+
|
|
406
|
+
it "should render sms_sent template for XHR requests" do
|
|
407
|
+
xhr :post, :sms, :id => doc_id, :to => '5555555555', :carrier => 'txt.att.net'
|
|
408
|
+
expect(request).to render_template 'sms_sent'
|
|
409
|
+
expect(request.flash[:success]).to eq "SMS Sent"
|
|
410
|
+
end
|
|
363
411
|
end
|
|
364
412
|
end
|
|
365
413
|
|
|
@@ -421,6 +469,30 @@ describe CatalogController do
|
|
|
421
469
|
response.body.should_not =~ /Login/
|
|
422
470
|
end
|
|
423
471
|
end
|
|
472
|
+
|
|
473
|
+
describe "facet" do
|
|
474
|
+
describe "requesting js" do
|
|
475
|
+
it "should be successful" do
|
|
476
|
+
xhr :get, :facet, id: 'format'
|
|
477
|
+
response.should be_successful
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
describe "requesting html" do
|
|
481
|
+
it "should be successful" do
|
|
482
|
+
get :facet, id: 'format'
|
|
483
|
+
response.should be_successful
|
|
484
|
+
assigns[:pagination].should be_kind_of Blacklight::Solr::FacetPaginator
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
describe "requesting json" do
|
|
488
|
+
it "should be successful" do
|
|
489
|
+
get :facet, id: 'format', format: 'json'
|
|
490
|
+
response.should be_successful
|
|
491
|
+
json = JSON.parse(response.body)
|
|
492
|
+
json["response"]["facets"]["items"].first["value"].should == 'Book'
|
|
493
|
+
end
|
|
494
|
+
end
|
|
495
|
+
end
|
|
424
496
|
end
|
|
425
497
|
|
|
426
498
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Alternate Controller Behaviors" do
|
|
4
|
+
it "should have the correct per-page form" do
|
|
5
|
+
visit alternate_index_path
|
|
6
|
+
page.should have_selector("form[action='#{alternate_index_path}']")
|
|
7
|
+
fill_in "q", :with=>"history"
|
|
8
|
+
click_button 'search'
|
|
9
|
+
expect(current_path).to match /#{alternate_index_path}/
|
|
10
|
+
click_on '10 per page'
|
|
11
|
+
expect(current_path).to match /#{alternate_index_path}/
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should have the correct search field form" do
|
|
15
|
+
visit alternate_index_path
|
|
16
|
+
page.should have_selector("form[action='#{alternate_index_path}']")
|
|
17
|
+
fill_in "q", :with=>"history"
|
|
18
|
+
click_button 'search'
|
|
19
|
+
expect(current_path).to match /#{alternate_index_path}/
|
|
20
|
+
click_on 'relevance'
|
|
21
|
+
expect(current_path).to match /#{alternate_index_path}/
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should display document thumbnails" do
|
|
25
|
+
visit alternate_index_path
|
|
26
|
+
page.should have_selector("form[action='#{alternate_index_path}']")
|
|
27
|
+
fill_in "q", :with=>"history"
|
|
28
|
+
click_button 'search'
|
|
29
|
+
expect(page).to have_selector ".document-thumbnail"
|
|
30
|
+
expect(page).to have_selector ".document-thumbnail a[data-counter]"
|
|
31
|
+
expect(page).to have_selector ".document-thumbnail a img"
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Bookmarks" do
|
|
4
|
+
describe "navigating from the homepage" do
|
|
5
|
+
it "should have a link to the history page" do
|
|
6
|
+
sign_in 'user1'
|
|
7
|
+
visit root_path
|
|
8
|
+
click_link 'Bookmarks'
|
|
9
|
+
expect(page).to have_content 'You have no bookmarks'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should clear bookmarks" do
|
|
14
|
+
visit catalog_path('2007020969')
|
|
15
|
+
click_button 'Bookmark'
|
|
16
|
+
click_link 'Bookmarks'
|
|
17
|
+
click_link 'Clear Bookmarks'
|
|
18
|
+
expect(page).to have_content 'Cleared your bookmarks.'
|
|
19
|
+
expect(page).to have_content 'You have no bookmarks'
|
|
20
|
+
end
|
|
21
|
+
it "add and remove bookmarks from search results" do
|
|
22
|
+
sign_in 'user1'
|
|
23
|
+
visit root_path
|
|
24
|
+
fill_in "q", with: 'book'
|
|
25
|
+
click_button 'search'
|
|
26
|
+
click_button 'Bookmark'
|
|
27
|
+
expect(page).to have_content 'Successfully added bookmark.'
|
|
28
|
+
fill_in "q", with: 'book'
|
|
29
|
+
click_button 'search'
|
|
30
|
+
click_button 'Remove bookmark'
|
|
31
|
+
expect(page).to have_content 'Successfully removed bookmark.'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should add and delete bookmarks from the show page" do
|
|
35
|
+
sign_in 'user1'
|
|
36
|
+
visit catalog_path('2007020969')
|
|
37
|
+
click_button 'Bookmark'
|
|
38
|
+
click_button 'Remove bookmark'
|
|
39
|
+
expect(page).to have_content 'Successfully removed bookmark.'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should add bookmarks after a user logs in" do
|
|
43
|
+
visit catalog_path('2007020969')
|
|
44
|
+
click_button 'Bookmark'
|
|
45
|
+
sign_in 'user1'
|
|
46
|
+
visit bookmarks_path
|
|
47
|
+
expect(page).to have_button("Remove bookmark")
|
|
48
|
+
expect(page).to have_content("Strong Medicine speaks")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should cite items in bookmarks" do
|
|
52
|
+
visit catalog_path('2007020969')
|
|
53
|
+
click_button 'Bookmark'
|
|
54
|
+
click_link 'Bookmarks'
|
|
55
|
+
click_link 'Cite'
|
|
56
|
+
expect(page).to have_content 'Strong Medicine speaks'
|
|
57
|
+
end
|
|
58
|
+
end
|