blacklight 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -6
  4. data/Gemfile +5 -0
  5. data/README.md +1 -1
  6. data/Rakefile +0 -1
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/blacklight/autofocus.js +16 -0
  9. data/app/assets/javascripts/blacklight/blacklight.js +1 -0
  10. data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
  11. data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
  12. data/app/assets/javascripts/blacklight/core.js +24 -1
  13. data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
  14. data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
  15. data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
  16. data/app/assets/javascripts/blacklight/search_context.js +1 -1
  17. data/app/assets/javascripts/blacklight/select_submit.js +1 -1
  18. data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
  19. data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
  20. data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
  21. data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
  22. data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
  23. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
  24. data/app/controllers/bookmarks_controller.rb +2 -2
  25. data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
  26. data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
  27. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
  28. data/app/models/record_mailer.rb +1 -16
  29. data/app/views/bookmarks/index.html.erb +2 -0
  30. data/app/views/catalog/_bookmark_control.html.erb +3 -4
  31. data/app/views/catalog/_document.html.erb +2 -1
  32. data/app/views/catalog/_document_header.html.erb +6 -3
  33. data/app/views/catalog/_email_form.html.erb +0 -7
  34. data/app/views/catalog/_facet_layout.html.erb +1 -1
  35. data/app/views/catalog/_group_default.html.erb +12 -0
  36. data/app/views/catalog/_index_default.html.erb +1 -1
  37. data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
  38. data/app/views/catalog/_paginate_compact.html.erb +2 -2
  39. data/app/views/catalog/_results_pagination.html.erb +2 -2
  40. data/app/views/catalog/_search_form.html.erb +1 -1
  41. data/app/views/catalog/_sms_form.html.erb +1 -21
  42. data/app/views/catalog/_thumbnail_default.html.erb +5 -0
  43. data/app/views/catalog/email_sent.html.erb +9 -0
  44. data/app/views/catalog/index.atom.builder +7 -8
  45. data/app/views/catalog/index.html.erb +6 -3
  46. data/app/views/catalog/librarian_view.html.erb +1 -1
  47. data/app/views/catalog/sms_sent.html.erb +9 -0
  48. data/app/views/feedback/complete.html.erb +2 -0
  49. data/app/views/feedback/show.html.erb +7 -5
  50. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
  51. data/app/views/layouts/blacklight.html.erb +1 -2
  52. data/app/views/saved_searches/index.html.erb +2 -0
  53. data/app/views/search_history/index.html.erb +1 -1
  54. data/blacklight.gemspec +1 -1
  55. data/config/locales/blacklight.en.yml +11 -0
  56. data/config/locales/blacklight.fr.yml +15 -1
  57. data/gemfiles/rails3.gemfile +7 -0
  58. data/gemfiles/rails4.gemfile +7 -0
  59. data/lib/blacklight.rb +1 -0
  60. data/lib/blacklight/catalog.rb +101 -56
  61. data/lib/blacklight/configuration.rb +1 -1
  62. data/lib/blacklight/controller.rb +7 -4
  63. data/lib/blacklight/facet.rb +79 -0
  64. data/lib/blacklight/routes.rb +0 -1
  65. data/lib/blacklight/solr/document.rb +4 -0
  66. data/lib/blacklight/solr/document/marc_export.rb +1 -1
  67. data/lib/blacklight/solr_helper.rb +39 -8
  68. data/lib/blacklight/solr_response.rb +35 -3
  69. data/lib/blacklight/solr_response/facets.rb +4 -0
  70. data/lib/blacklight/solr_response/group.rb +33 -0
  71. data/lib/blacklight/solr_response/group_response.rb +49 -0
  72. data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
  73. data/lib/blacklight/user.rb +30 -32
  74. data/lib/generators/blacklight/assets_generator.rb +3 -1
  75. data/lib/generators/blacklight/blacklight_generator.rb +28 -125
  76. data/lib/generators/blacklight/marc_generator.rb +66 -0
  77. data/lib/generators/blacklight/models_generator.rb +113 -0
  78. data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
  79. data/lib/generators/blacklight/templates/config/solr.yml +0 -2
  80. data/lib/generators/blacklight/templates/solr_document.rb +1 -13
  81. data/lib/railties/all_tests.rake +5 -8
  82. data/spec/controllers/catalog_controller_spec.rb +185 -113
  83. data/spec/features/alternate_controller_spec.rb +34 -0
  84. data/spec/features/bookmarks_spec.rb +58 -0
  85. data/spec/features/did_you_mean_spec.rb +135 -0
  86. data/spec/features/librarian_view_spec.rb +13 -0
  87. data/spec/features/record_view_spec.rb +37 -0
  88. data/spec/features/saved_searches_spec.rb +47 -0
  89. data/spec/features/search_filters_spec.rb +137 -0
  90. data/spec/features/search_history_spec.rb +75 -0
  91. data/spec/features/search_pagination_spec.rb +91 -0
  92. data/spec/features/search_results_spec.rb +68 -0
  93. data/spec/features/search_sort_spec.rb +20 -0
  94. data/spec/features/search_spec.rb +108 -0
  95. data/spec/helpers/blacklight_helper_spec.rb +45 -2
  96. data/spec/helpers/catalog_helper_spec.rb +134 -1
  97. data/spec/helpers/facets_helper_spec.rb +8 -0
  98. data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
  99. data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
  100. data/spec/lib/blacklight_solr_response_spec.rb +11 -5
  101. data/spec/lib/blacklight_user_spec.rb +22 -41
  102. data/spec/lib/solr_helper_spec.rb +73 -1
  103. data/spec/models/record_mailer_spec.rb +3 -3
  104. data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
  105. data/spec/spec_helper.rb +0 -1
  106. data/spec/support/features.rb +7 -0
  107. data/spec/support/features/session_helpers.rb +22 -0
  108. data/spec/test_app_templates/Gemfile.extra +0 -4
  109. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
  110. data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
  111. data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
  112. data/tasks/blacklight.rake +0 -10
  113. metadata +49 -58
  114. data/features/bookmarks.feature +0 -68
  115. data/features/did_you_mean.feature +0 -123
  116. data/features/librarian_view.feature +0 -18
  117. data/features/record_view.feature +0 -40
  118. data/features/saved_searches.feature +0 -49
  119. data/features/search.feature +0 -83
  120. data/features/search_filters.feature +0 -119
  121. data/features/search_history.feature +0 -85
  122. data/features/search_pagination.feature +0 -53
  123. data/features/search_results.feature +0 -61
  124. data/features/search_sort.feature +0 -27
  125. data/features/step_definitions/bookmarks_steps.rb +0 -6
  126. data/features/step_definitions/error_steps.rb +0 -5
  127. data/features/step_definitions/general_steps.rb +0 -50
  128. data/features/step_definitions/record_view_steps.rb +0 -12
  129. data/features/step_definitions/saved_searches_steps.rb +0 -19
  130. data/features/step_definitions/search_facets_steps.rb +0 -29
  131. data/features/step_definitions/search_history_steps.rb +0 -9
  132. data/features/step_definitions/search_pagination_steps.rb +0 -29
  133. data/features/step_definitions/search_result_steps.rb +0 -115
  134. data/features/step_definitions/search_steps.rb +0 -118
  135. data/features/step_definitions/user_steps.rb +0 -5
  136. data/features/step_definitions/web_steps.rb +0 -217
  137. data/features/support/env.rb +0 -65
  138. data/features/support/paths.rb +0 -48
  139. data/features/support/selectors.rb +0 -40
  140. data/lib/railties/blacklight_cucumber.rake +0 -126
  141. data/lib/solrmarc.log.1 +0 -854
@@ -360,6 +360,14 @@ describe FacetsHelper do
360
360
 
361
361
  end
362
362
 
363
+ describe "facet_field_in_params?" do
364
+ it "should check if the facet field is selected in the user params" do
365
+ helper.stub(:params => { :f => { "some-field" => ["x"]}})
366
+ expect(helper.facet_field_in_params?("some-field")).to be_true
367
+ expect(helper.facet_field_in_params?("other-field")).to_not be_true
368
+ end
369
+ end
370
+
363
371
  describe "facet_in_params?" do
364
372
 
365
373
  end
@@ -0,0 +1,78 @@
1
+ require "spec_helper"
2
+
3
+ describe Blacklight::SolrResponse::GroupResponse do
4
+
5
+ let(:response) do
6
+ create_response(sample_response)
7
+ end
8
+
9
+ let(:group) do
10
+ response.grouped.select { |x| x.key == "result_group_ssi" }.first
11
+ end
12
+
13
+ describe "groups" do
14
+ it "should return an array of Groups" do
15
+ response.grouped.should be_a Array
16
+
17
+ expect(group.groups).to have(2).items
18
+ group.groups.each do |group|
19
+ expect(group).to be_a Blacklight::SolrResponse::Group
20
+ end
21
+ end
22
+ it "should include a list of SolrDocuments" do
23
+
24
+ group.groups.each do |group|
25
+ group.docs.each do |doc|
26
+ expect(doc).to be_a SolrDocument
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "total" do
33
+ it "should return the ngroups value" do
34
+ expect(group.total).to eq 3
35
+ end
36
+ end
37
+
38
+ describe "facets" do
39
+ it "should exist in the response object (not testing, we just extend the module)" do
40
+ expect(group).to respond_to :facets
41
+ end
42
+ end
43
+
44
+ describe "rows" do
45
+ it "should get the rows from the response" do
46
+ expect(group.rows).to eq 3
47
+ end
48
+ end
49
+
50
+ describe "group_field" do
51
+ it "should be the field name for the current group" do
52
+ expect(group.group_field).to eq "result_group_ssi"
53
+ end
54
+ end
55
+
56
+ describe "group_limit" do
57
+ it "should be the number of documents to return for a group" do
58
+ expect(group.group_limit).to eq 5
59
+ end
60
+ end
61
+ end
62
+
63
+ def create_response(response, params = {})
64
+ Blacklight::SolrResponse.new(response, params)
65
+ end
66
+
67
+ def sample_response
68
+ {"responseHeader" => {"params" =>{"rows" => 3, "group.limit" => 5}},
69
+ "grouped" =>
70
+ {'result_group_ssi' =>
71
+ {'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'docs'=>[{:id=>1}]}},
72
+ {'groupValue'=>"Group 2", 'doclist'=>{'numFound'=>3, 'docs'=>[{:id=>2}, :id=>3]}}
73
+ ],
74
+ 'ngroups' => "3"
75
+ }
76
+ }
77
+ }
78
+ end
@@ -0,0 +1,70 @@
1
+ require "spec_helper"
2
+
3
+ describe Blacklight::SolrResponse::Group do
4
+
5
+ let(:response) do
6
+ create_response(sample_response)
7
+ end
8
+
9
+ let(:group) do
10
+ response.grouped.select { |x| x.key == "result_group_ssi" }.first
11
+ end
12
+
13
+ subject do
14
+ group.groups.first
15
+ end
16
+
17
+ describe "#doclist" do
18
+ it "should be the raw list of documents from solr" do
19
+ expect(subject.doclist).to be_a Hash
20
+ expect(subject.doclist['docs'].first[:id]).to eq 1
21
+ end
22
+ end
23
+
24
+ describe "#total" do
25
+ it "should be the number of results found in a group" do
26
+ expect(subject.total).to eq 2
27
+ end
28
+ end
29
+
30
+ describe "#start" do
31
+ it "should be the offset for the results in the group" do
32
+ expect(subject.start).to eq 0
33
+ end
34
+ end
35
+
36
+ describe "#docs" do
37
+ it "should be a list of SolrDocuments" do
38
+ subject.docs.each do |doc|
39
+ expect(doc).to be_a_kind_of SolrDocument
40
+ end
41
+
42
+ expect(subject.docs.first.id).to eq 1
43
+ end
44
+ end
45
+
46
+ describe "#field" do
47
+ it "should be the field the group belongs to" do
48
+ expect(subject.field).to eq "result_group_ssi"
49
+ end
50
+ end
51
+
52
+
53
+ end
54
+
55
+ def create_response(response, params = {})
56
+ Blacklight::SolrResponse.new(response, params)
57
+ end
58
+
59
+ def sample_response
60
+ {"responseHeader" => {"params" =>{"rows" => 3, "group.limit" => 5}},
61
+ "grouped" =>
62
+ {'result_group_ssi' =>
63
+ {'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'start' => 0, 'docs'=>[{:id=>1}, {:id => 'x'}]}},
64
+ {'groupValue'=>"Group 2", 'doclist'=>{'numFound'=>3, 'docs'=>[{:id=>2}, :id=>3]}}
65
+ ],
66
+ 'ngroups' => "3"
67
+ }
68
+ }
69
+ }
70
+ end
@@ -8,21 +8,19 @@ describe Blacklight::SolrResponse do
8
8
  Blacklight::SolrResponse.new(raw_response, raw_response['params'])
9
9
  end
10
10
 
11
+ let(:r) { create_response }
12
+
11
13
  it 'should create a valid response' do
12
- r = create_response
13
14
  r.should respond_to(:header)
14
15
  end
15
16
 
16
17
  it 'should have accurate pagination numbers' do
17
- r = create_response
18
18
  r.rows.should == 11
19
19
  r.total.should == 26
20
20
  r.start.should == 0
21
21
  end
22
22
 
23
23
  it 'should create a valid response class' do
24
- r = create_response
25
-
26
24
  r.should respond_to(:response)
27
25
  r.docs.size.should == 11
28
26
  r.params[:echoParams].should == 'EXPLICIT'
@@ -31,7 +29,6 @@ describe Blacklight::SolrResponse do
31
29
  end
32
30
 
33
31
  it 'should provide facet helpers' do
34
- r = create_response
35
32
  r.facets.size.should == 2
36
33
 
37
34
  field_names = r.facets.collect{|facet|facet.name}
@@ -60,6 +57,15 @@ describe Blacklight::SolrResponse do
60
57
 
61
58
  end
62
59
 
60
+ it "should provide kaminari pagination helpers" do
61
+ expect(r.limit_value).to eq(r.rows)
62
+ expect(r.offset_value).to eq(r.start)
63
+ expect(r.total_count).to eq(r.total)
64
+ expect(r.next_page).to eq(r.current_page + 1)
65
+ expect(r.prev_page).to eq(nil)
66
+ expect(r).to be_a_kind_of Kaminari::PageScopeMethods
67
+ end
68
+
63
69
  describe "FacetItem" do
64
70
  it "should work with a field,value tuple" do
65
71
  item = Blacklight::SolrResponse::Facets::FacetItem.new('value', 15)
@@ -2,76 +2,57 @@
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
 
4
4
  describe "Blacklight::User" do
5
- class MockUser
6
- include Blacklight::User::InstanceMethods
7
- attr_accessor :searches
8
- attr_accessor :bookmarks
9
- end
10
-
11
- class MockBookmark
12
- attr_accessor :document_id
13
5
 
14
- def initialize document_id
15
- self.document_id = document_id
16
- end
17
- end
18
-
19
- before(:each) do
20
- @user = MockUser.new
21
- @user.searches = []
22
- @user.bookmarks = []
23
- end
6
+ subject { User.create! :email => 'xyz@example.com', :password => 'xyz12345' }
24
7
 
25
- def mock_bookmark doc_id
26
- MockBookmark.new doc_id
8
+ def mock_bookmark document_id
9
+ Bookmark.new :document_id => document_id
27
10
  end
28
11
 
29
12
  it "should know if it doesn't have bookmarks" do
30
- @user.has_bookmarks?.should == false
13
+ expect(subject).to_not have_bookmarks
31
14
  end
32
15
 
33
16
  it "should know if it has bookmarkss" do
34
- @user.bookmarks.push(mock_bookmark(1))
35
- @user.bookmarks.push(mock_bookmark(2))
36
- @user.has_bookmarks?.should == true
37
- end
17
+ subject.bookmarks << mock_bookmark(1)
18
+ subject.bookmarks << mock_bookmark(2)
38
19
 
39
- it "should know if it has a bookmarked document" do
40
- @user.bookmarks.push(mock_bookmark(1))
41
- @user.should be_document_is_bookmarked(1)
20
+ expect(subject).to have_bookmarks
42
21
  end
43
22
 
44
- it "should return a bookmark it a document is bookmarked" do
45
- @user.bookmarks.push(mock_bookmark(1))
46
- @user.existing_bookmark_for(1).should be_a_kind_of(MockBookmark)
23
+ it "should know if it has a bookmarked document" do
24
+ subject.bookmarks << mock_bookmark(1)
25
+ expect(subject.document_is_bookmarked?(1)).to be_true
47
26
  end
48
27
 
49
28
  it "should be able to create bookmarks in batches" do
50
29
  @md1 = { :document_id => 1 }
51
30
  @md2 = { :document_id => 2 }
52
31
  @md3 = { :document_id => 3 }
53
- @user.bookmarks.should_receive(:create).with(@md1)
54
- @user.bookmarks.should_receive(:create).with(@md2)
55
- @user.bookmarks.should_receive(:create).with(@md3)
56
32
 
57
- @user.documents_to_bookmark= [@md1,@md2,@md3]
33
+ subject.documents_to_bookmark= [@md1,@md2,@md3]
34
+ expect(subject.bookmarks).to have(3).bookmarks
35
+ expect(subject.bookmarked_document_ids).to include("1","2","3")
36
+
58
37
  end
59
38
 
60
39
  it "should not recreate bookmarks for documents already bookmarked" do
40
+ subject.bookmarks << mock_bookmark(1)
41
+
61
42
  @md1 = { :document_id => 1 }
62
- @user.bookmarks.should_not_receive(:create).with(@md1)
43
+ subject.bookmarks.should_not_receive(:create).with(@md1)
63
44
 
64
- @user.bookmarks.push(mock_bookmark(1))
65
- @user.documents_to_bookmark=[@md1]
45
+ subject.bookmarks.push(mock_bookmark(1))
46
+ subject.documents_to_bookmark=[@md1]
66
47
  end
67
48
 
68
49
  it "should know if it doesn't have a search" do
69
- @user.has_searches?.should == false
50
+ subject.has_searches?.should == false
70
51
  end
71
52
 
72
53
  it "should know if it has a search" do
73
- @user.searches.push(1)
74
- @user.has_searches?.should == true
54
+ subject.searches << Search.new
55
+ subject.has_searches?.should == true
75
56
  end
76
57
 
77
58
  end
@@ -277,6 +277,8 @@ describe 'Blacklight::SolrHelper' do
277
277
  config = Blacklight::Configuration.new
278
278
 
279
279
  config.add_facet_field 'test_field', :sort => 'count'
280
+ config.add_facet_field 'some-query', :query => {'x' => {:fq => 'some:query' }}, :ex => 'xyz'
281
+ config.add_facet_field 'some-pivot', :pivot => ['a','b'], :ex => 'xyz'
280
282
  config.add_facet_fields_to_solr_request!
281
283
 
282
284
  config
@@ -291,6 +293,15 @@ describe 'Blacklight::SolrHelper' do
291
293
  solr_parameters[:'facet.field'].should include('test_field')
292
294
  solr_parameters[:'f.test_field.facet.sort'].should == 'count'
293
295
  end
296
+
297
+ it "should add facet exclusions" do
298
+ solr_parameters = { }
299
+
300
+ add_facetting_to_solr(solr_parameters, {})
301
+
302
+ solr_parameters[:'facet.query'].should include('{!ex=xyz}some:query')
303
+ solr_parameters[:'facet.pivot'].should include('{!ex=xyz}a,b')
304
+ end
294
305
  end
295
306
 
296
307
  describe "with a complex parameter environment" do
@@ -379,7 +390,8 @@ describe 'Blacklight::SolrHelper' do
379
390
  :key => "custom_author_key",
380
391
  :solr_local_parameters => {
381
392
  :qf => "$author_qf",
382
- :pf => "you'll have \" to escape this"
393
+ :pf => "you'll have \" to escape this",
394
+ :pf2 => "$pf2_do_not_escape_or_quote"
383
395
  },
384
396
  :solr_parameters => {
385
397
  :qf => "someField^1000",
@@ -406,6 +418,7 @@ describe 'Blacklight::SolrHelper' do
406
418
  it "should include include local params with escaping" do
407
419
  @result[:q].should include('qf=$author_qf')
408
420
  @result[:q].should include('pf=\'you\\\'ll have \\" to escape this\'')
421
+ @result[:q].should include('pf2=$pf2_do_not_escape_or_quote')
409
422
  end
410
423
  end
411
424
 
@@ -578,6 +591,40 @@ describe 'Blacklight::SolrHelper' do
578
591
  end
579
592
  end
580
593
 
594
+ describe "for a query returning a grouped response" do
595
+ before(:all) do
596
+ (@solr_response, @document_list) = get_search_results({:q => @all_docs_query}, :group => true, :'group.field' => 'pub_date_sort')
597
+ end
598
+
599
+ it "should have an empty document list" do
600
+ expect(@document_list).to be_empty
601
+ end
602
+
603
+ it "should return a grouped response" do
604
+ expect(@solr_response).to be_a_kind_of Blacklight::SolrResponse::GroupResponse
605
+
606
+ end
607
+ end
608
+
609
+ describe "for a query returning multiple groups" do
610
+ before(:all) do
611
+ (@solr_response, @document_list) = get_search_results({:q => @all_docs_query}, :group => true, :'group.field' => ['pub_date_sort', 'title_sort'])
612
+ end
613
+
614
+ def grouped_key_for_results
615
+ 'title_sort'
616
+ end
617
+
618
+ it "should have an empty document list" do
619
+ expect(@document_list).to be_empty
620
+ end
621
+
622
+ it "should return a grouped response" do
623
+ expect(@solr_response).to be_a_kind_of Blacklight::SolrResponse::GroupResponse
624
+ expect(@solr_response.group_field).to eq "title_sort"
625
+ end
626
+ end
627
+
581
628
  describe '#query_solr' do
582
629
  it 'should have results' do
583
630
  solr_response = query_solr(:q => @single_word_query)
@@ -1044,5 +1091,30 @@ describe 'Blacklight::SolrHelper' do
1044
1091
  Blacklight.solr.stub(:get).and_raise(Errno::ECONNREFUSED)
1045
1092
  expect { find(:a => 123) }.to raise_exception(/Unable to connect to Solr instance/)
1046
1093
  end
1094
+
1095
+ describe "grouped_key_for_results" do
1096
+ let :blacklight_config do
1097
+ Blacklight::Configuration.new
1098
+ end
1099
+
1100
+ it "should pull the grouped key out of the config" do
1101
+ blacklight_config.index.group = 'xyz'
1102
+ expect(self.grouped_key_for_results).to eq('xyz')
1103
+ end
1104
+ end
1105
+
1106
+ describe "#with_tag_ex" do
1107
+ it "should add an !ex local parameter if the facet configuration requests it" do
1108
+ expect(self.with_ex_local_param("xyz", "some-value")).to eq "{!ex=xyz}some-value"
1109
+ end
1110
+
1111
+ it "should not add an !ex local parameter if it isn't configured" do
1112
+ mock_field = double()
1113
+ expect(self.with_ex_local_param(nil, "some-value")).to eq "some-value"
1114
+ end
1115
+
1116
+
1117
+ end
1118
+
1047
1119
  end
1048
1120
 
@@ -41,7 +41,7 @@ describe RecordMailer do
41
41
 
42
42
  describe "SMS" do
43
43
  before(:each) do
44
- details = {:to => '5555555555', :carrier => 'att'}
44
+ details = {:to => '5555555555@txt.att.net'}
45
45
  @sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org:3000'})
46
46
  end
47
47
  it "should create the correct TO address for the SMS email" do
@@ -56,10 +56,10 @@ describe RecordMailer do
56
56
  it "should print out the correct body" do
57
57
  @sms.body.should =~ /The horn/
58
58
  @sms.body.should =~ /by Janetzky, Kurt/
59
- @sms.body.should =~ /projectblacklight.org:300/
59
+ @sms.body.should =~ /projectblacklight.org:3000/
60
60
  end
61
61
  it "should use https URL when protocol is set" do
62
- details = {:to => '5555555555', :carrier => 'att'}
62
+ details = {:to => '5555555555@txt.att.net'}
63
63
  @https_sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
64
64
  @https_sms.body.should =~ %r|https://projectblacklight.org/|
65
65
  end