blacklight 4.7.0 → 4.8.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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +13 -12
  4. data/Gemfile +37 -2
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/{_blacklight_base.css.scss → _blacklight_base.scss} +0 -0
  7. data/app/assets/stylesheets/blacklight/{_bookmark.css.scss → _bookmark.scss} +0 -0
  8. data/app/assets/stylesheets/blacklight/{_catalog.css.scss → _catalog.scss} +0 -0
  9. data/app/assets/stylesheets/blacklight/{_dropdown.css.scss → _dropdown.scss} +0 -0
  10. data/app/assets/stylesheets/blacklight/{_facets.css.scss → _facets.scss} +0 -0
  11. data/app/assets/stylesheets/blacklight/{_footer.css.scss → _footer.scss} +0 -0
  12. data/app/assets/stylesheets/blacklight/{_group.css.scss → _group.scss} +0 -0
  13. data/app/assets/stylesheets/blacklight/{_header.css.scss → _header.scss} +0 -0
  14. data/app/assets/stylesheets/blacklight/{_layout.css.scss → _layout.scss} +0 -0
  15. data/app/assets/stylesheets/blacklight/{_mixins.css.scss → _mixins.scss} +0 -0
  16. data/app/assets/stylesheets/blacklight/{_modal.css.scss → _modal.scss} +0 -0
  17. data/app/assets/stylesheets/blacklight/{_print.css.scss → _print.scss} +0 -0
  18. data/app/assets/stylesheets/blacklight/{_responsive.css.scss → _responsive.scss} +0 -0
  19. data/app/assets/stylesheets/blacklight/{_search_history.css.scss → _search_history.scss} +0 -0
  20. data/app/assets/stylesheets/blacklight/{blacklight.css.scss → blacklight.scss} +0 -0
  21. data/app/assets/stylesheets/blacklight/{blacklight_defaults.css.scss → blacklight_defaults.scss} +0 -0
  22. data/app/assets/stylesheets/blacklight/responsive_partials/{_catalog.css.scss → _catalog.scss} +0 -0
  23. data/app/assets/stylesheets/blacklight/responsive_partials/{_facets.css.scss → _facets.scss} +0 -0
  24. data/app/assets/stylesheets/blacklight/responsive_partials/{_header.css.scss → _header.scss} +0 -0
  25. data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -2
  26. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
  27. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -0
  28. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
  29. data/blacklight.gemspec +5 -6
  30. data/lib/blacklight/catalog.rb +1 -1
  31. data/lib/blacklight/catalog/search_context.rb +6 -6
  32. data/lib/blacklight/solr/document.rb +29 -21
  33. data/lib/blacklight/solr_helper.rb +6 -4
  34. data/lib/generators/blacklight/templates/{blacklight.css.scss → blacklight.scss} +0 -0
  35. data/spec/controllers/application_controller_spec.rb +3 -3
  36. data/spec/controllers/bookmarks_controller_spec.rb +11 -11
  37. data/spec/controllers/catalog_controller_spec.rb +117 -117
  38. data/spec/controllers/search_history_controller_spec.rb +8 -8
  39. data/spec/features/alternate_controller_spec.rb +7 -5
  40. data/spec/features/record_view_spec.rb +4 -1
  41. data/spec/features/search_filters_spec.rb +37 -24
  42. data/spec/features/search_pagination_spec.rb +11 -7
  43. data/spec/features/search_results_spec.rb +22 -14
  44. data/spec/features/search_sort_spec.rb +3 -1
  45. data/spec/features/search_spec.rb +6 -0
  46. data/spec/helpers/blacklight_helper_spec.rb +175 -166
  47. data/spec/helpers/catalog_helper_spec.rb +59 -59
  48. data/spec/helpers/facets_helper_spec.rb +118 -118
  49. data/spec/helpers/hash_as_hidden_fields_spec.rb +14 -8
  50. data/spec/helpers/html_head_helper_spec.rb +51 -45
  51. data/spec/helpers/render_constraints_helper_spec.rb +5 -6
  52. data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
  53. data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
  54. data/spec/lib/blacklight_configurable_spec.rb +16 -16
  55. data/spec/lib/blacklight_configuration_spec.rb +132 -132
  56. data/spec/lib/blacklight_email_spec.rb +4 -4
  57. data/spec/lib/blacklight_sms_spec.rb +4 -4
  58. data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
  59. data/spec/lib/blacklight_solr_document_marc_spec.rb +3 -3
  60. data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
  61. data/spec/lib/blacklight_solr_document_spec.rb +36 -36
  62. data/spec/lib/blacklight_solr_response_spec.rb +42 -42
  63. data/spec/lib/blacklight_spec.rb +5 -5
  64. data/spec/lib/blacklight_user_spec.rb +5 -5
  65. data/spec/lib/facet_paginator_spec.rb +12 -12
  66. data/spec/lib/marc_export_spec.rb +746 -746
  67. data/spec/lib/search_fields_spec.rb +13 -13
  68. data/spec/lib/solr_helper_spec.rb +255 -250
  69. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  70. data/spec/lib/tasks/solr_marc_task_spec.rb +6 -6
  71. data/spec/lib/utils_spec.rb +11 -11
  72. data/spec/models/bookmark_spec.rb +7 -6
  73. data/spec/models/record_mailer_spec.rb +16 -16
  74. data/spec/models/search_spec.rb +8 -8
  75. data/spec/models/solr_document_spec.rb +7 -7
  76. data/spec/requests/alternate_controller_spec.rb +3 -3
  77. data/spec/routing/catalog_routing_spec.rb +10 -15
  78. data/spec/spec_helper.rb +6 -4
  79. data/spec/support/assert_difference.rb +2 -2
  80. data/spec/support/features.rb +11 -0
  81. data/spec/support/features/session_helpers.rb +3 -3
  82. data/spec/support/include_text.rb +2 -2
  83. data/spec/test_app_templates/Gemfile.extra +2 -15
  84. data/spec/test_app_templates/lib/generators/test_app_generator.rb +17 -6
  85. data/spec/views/catalog/_constraints.html.erb_spec.rb +7 -7
  86. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +12 -12
  87. data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
  88. data/spec/views/catalog/_facets.html.erb_spec.rb +13 -13
  89. data/spec/views/catalog/_index_default.erb_spec.rb +20 -20
  90. data/spec/views/catalog/_show_default.erb_spec.rb +20 -20
  91. data/spec/views/catalog/_show_sidebar.erb_spec.rb +6 -6
  92. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
  93. data/spec/views/catalog/index.atom.builder_spec.rb +28 -28
  94. data/spec/views/catalog/index.html.erb_spec.rb +6 -6
  95. metadata +35 -57
  96. data/gemfiles/rails3.gemfile +0 -25
  97. data/gemfiles/rails4.gemfile +0 -24
@@ -15,7 +15,7 @@ describe "blacklight:delete_old_searches" do
15
15
 
16
16
  it "should call Search.delete_old_searches" do
17
17
  days_old = 7
18
- Search.should_receive(:delete_old_searches).with(days_old)
18
+ expect(Search).to receive(:delete_old_searches).with(days_old)
19
19
  @rake[@task_name].invoke(days_old)
20
20
  end
21
21
 
@@ -32,7 +32,7 @@ describe "solr:marc:*" do
32
32
  @rake['solr:marc:index_test_data'].invoke
33
33
  end
34
34
 
35
- o.should match(Regexp.escape("SolrMarc command that will be run:"))
35
+ expect(o).to match(Regexp.escape("SolrMarc command that will be run:"))
36
36
  end
37
37
  end
38
38
 
@@ -48,11 +48,11 @@ describe "solr:marc:*" do
48
48
  output =~ /SolrMarc command that will be run:\n\s*\n\s*(.*)\n/
49
49
  java_cmd = $1
50
50
 
51
- java_cmd.should_not be_nil
52
- java_cmd.should match "java -Xmx512m"
53
- java_cmd.should match /-jar .*\/SolrMarc\.jar/
54
- java_cmd.should match "#{Rails.root}/config/SolrMarc/config-test.properties dummy.mrc"
55
- java_cmd.should match "-Dsolr.hosturl=http://127.0.0.1:[0-9]{2,5}/solr"
51
+ expect(java_cmd).not_to be_nil
52
+ expect(java_cmd).to match "java -Xmx512m"
53
+ expect(java_cmd).to match /-jar .*\/SolrMarc\.jar/
54
+ expect(java_cmd).to match "#{Rails.root}/config/SolrMarc/config-test.properties dummy.mrc"
55
+ expect(java_cmd).to match "-Dsolr.hosturl=http://127.0.0.1:[0-9]{2,5}/solr"
56
56
  end
57
57
 
58
58
  end
@@ -6,16 +6,16 @@ describe 'Blacklight::Utils' do
6
6
  it "should provide hash-like accessors for OpenStruct data" do
7
7
  a = Blacklight::OpenStructWithHashAccess.new :foo => :bar, :baz => 1
8
8
 
9
- a[:foo].should == :bar
10
- a[:baz].should == 1
11
- a[:asdf].should be_nil
9
+ expect(a[:foo]).to eq(:bar)
10
+ expect(a[:baz]).to eq(1)
11
+ expect(a[:asdf]).to be_nil
12
12
  end
13
13
 
14
14
  it "should provide hash-like writers for OpenStruct data" do
15
15
  a = Blacklight::OpenStructWithHashAccess.new :foo => :bar, :baz => 1
16
16
 
17
17
  a[:asdf] = 'qwerty'
18
- a.asdf.should == 'qwerty'
18
+ expect(a.asdf).to eq('qwerty')
19
19
 
20
20
  end
21
21
 
@@ -23,12 +23,12 @@ describe 'Blacklight::Utils' do
23
23
  h = Blacklight::OpenStructWithHashAccess.new
24
24
 
25
25
  h["string"] = "value"
26
- h[:string].should == "value"
27
- h.string.should == "value"
26
+ expect(h[:string]).to eq("value")
27
+ expect(h.string).to eq("value")
28
28
 
29
29
  h[:symbol] = "value"
30
- h["symbol"].should == "value"
31
- h.symbol.should == "value"
30
+ expect(h["symbol"]).to eq("value")
31
+ expect(h.symbol).to eq("value")
32
32
  end
33
33
 
34
34
  describe "internal hash table" do
@@ -39,12 +39,12 @@ describe 'Blacklight::Utils' do
39
39
  end
40
40
 
41
41
  it "should expose the internal hash table" do
42
- @h.to_h.should be_a_kind_of(Hash)
43
- @h.to_h[:a].should == 1
42
+ expect(@h.to_h).to be_a_kind_of(Hash)
43
+ expect(@h.to_h[:a]).to eq(1)
44
44
  end
45
45
 
46
46
  it "should expose keys" do
47
- @h.keys.should include(:a, :b)
47
+ expect(@h.keys).to include(:a, :b)
48
48
  end
49
49
  end
50
50
 
@@ -5,20 +5,21 @@ describe Bookmark do
5
5
  before(:each) do
6
6
  @bookmark = Bookmark.new
7
7
  end
8
-
8
+
9
9
  it "should be valid" do
10
10
  @bookmark.id = 1
11
11
  @bookmark.user_id = 1
12
12
  @bookmark.document_id = 'u001'
13
- @bookmark.should be_valid
13
+ expect(@bookmark).to be_valid
14
14
  end
15
-
15
+
16
16
  it "should require user_id" do
17
- @bookmark.should have(1).error_on(:user_id)
17
+ expect(@bookmark).not_to be_valid
18
+ expect(@bookmark.errors[:user_id].length).to eq 1
18
19
  end
19
20
 
20
21
  it "should belong to user" do
21
- Bookmark.reflect_on_association(:user).should_not be_nil
22
+ expect(Bookmark.reflect_on_association(:user)).not_to be_nil
22
23
  end
23
24
 
24
25
  it "should be valid after saving" do
@@ -26,6 +27,6 @@ describe Bookmark do
26
27
  @bookmark.user_id = 1
27
28
  @bookmark.document_id = 'u001'
28
29
  @bookmark.save
29
- @bookmark.should be_valid
30
+ expect(@bookmark).to be_valid
30
31
  end
31
32
  end
@@ -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.stub(:default) { { :from => 'no-reply@projectblacklight.org' } }
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"})
@@ -16,26 +16,26 @@ describe RecordMailer do
16
16
  @email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
17
17
  end
18
18
  it "should receive the TO paramater and send the email to that address" do
19
- @email.to.should == ['test@test.com']
19
+ expect(@email.to).to eq(['test@test.com'])
20
20
  end
21
21
  it "should start the subject w/ Item Record:" do
22
- @email.subject.should =~ /^Item Record:/
22
+ expect(@email.subject).to match(/^Item Record:/)
23
23
  end
24
24
  it "should put the title of the item in the subject" do
25
- @email.subject.should =~ /The horn/
25
+ expect(@email.subject).to match(/The horn/)
26
26
  end
27
27
  it "should have the correct from address (w/o the port number)" do
28
- @email.from.should == ["no-reply@projectblacklight.org"]
28
+ expect(@email.from).to eq(["no-reply@projectblacklight.org"])
29
29
  end
30
30
  it "should print out the correct body" do
31
- @email.body.should =~ /Title: The horn/
32
- @email.body.should =~ /Author: Janetzky, Kurt/
33
- @email.body.should =~ /projectblacklight.org/
31
+ expect(@email.body).to match(/Title: The horn/)
32
+ expect(@email.body).to match(/Author: Janetzky, Kurt/)
33
+ expect(@email.body).to match(/projectblacklight.org/)
34
34
  end
35
35
  it "should use https URLs when protocol is set" do
36
36
  details = {:to => 'test@test.com', :message => "This is my message"}
37
37
  @https_email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
38
- @https_email.body.should =~ %r|https://projectblacklight.org/|
38
+ expect(@https_email.body).to match(%r|https://projectblacklight.org/|)
39
39
  end
40
40
  end
41
41
 
@@ -45,23 +45,23 @@ describe RecordMailer do
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
48
- @sms.to.should == ['5555555555@txt.att.net']
48
+ expect(@sms.to).to eq(['5555555555@txt.att.net'])
49
49
  end
50
50
  it "should not have a subject" do
51
- @sms.subject.should == "" unless @sms.subject.nil?
51
+ expect(@sms.subject).to eq("") unless @sms.subject.nil?
52
52
  end
53
53
  it "should have the correct from address (w/o the port number)" do
54
- @sms.from.should == ["no-reply@projectblacklight.org"]
54
+ expect(@sms.from).to eq(["no-reply@projectblacklight.org"])
55
55
  end
56
56
  it "should print out the correct body" do
57
- @sms.body.should =~ /The horn/
58
- @sms.body.should =~ /by Janetzky, Kurt/
59
- @sms.body.should =~ /projectblacklight.org:3000/
57
+ expect(@sms.body).to match(/The horn/)
58
+ expect(@sms.body).to match(/by Janetzky, Kurt/)
59
+ expect(@sms.body).to match(/projectblacklight.org:3000/)
60
60
  end
61
61
  it "should use https URL when protocol is set" do
62
62
  details = {:to => '5555555555@txt.att.net'}
63
63
  @https_sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
64
- @https_sms.body.should =~ %r|https://projectblacklight.org/|
64
+ expect(@https_sms.body).to match(%r|https://projectblacklight.org/|)
65
65
  end
66
66
  end
67
67
 
@@ -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.should == @query_params
17
+ expect(Search.find(@search.id).query_params).to eq(@query_params)
18
18
  end
19
19
  end
20
20
 
@@ -24,23 +24,23 @@ describe Search do
24
24
  @search.user_id = 1
25
25
  @search.save
26
26
 
27
- @search.saved?.should be_true
27
+ expect(@search.saved?).to be_truthy
28
28
  end
29
29
  it "should be false when user_id is NULL or less than 1" do
30
30
  @search = Search.create
31
- @search.saved?.should_not be_true
31
+ expect(@search.saved?).not_to be_truthy
32
32
  end
33
33
  end
34
34
 
35
35
  describe "delete_old_searches" do
36
36
  it "should throw an ArgumentError if days_old is not a number" do
37
- lambda { Search.delete_old_searches("blah") }.should raise_error(ArgumentError)
37
+ expect { Search.delete_old_searches("blah") }.to raise_error(ArgumentError)
38
38
  end
39
39
  it "should throw an ArgumentError if days_old is equal to 0" do
40
- lambda { Search.delete_old_searches(0) }.should raise_error(ArgumentError)
40
+ expect { Search.delete_old_searches(0) }.to raise_error(ArgumentError)
41
41
  end
42
42
  it "should throw an ArgumentError if days_old is less than 0" do
43
- lambda { Search.delete_old_searches(-1) }.should raise_error(ArgumentError)
43
+ expect { Search.delete_old_searches(-1) }.to raise_error(ArgumentError)
44
44
  end
45
45
  it "should destroy searches with no user_id that are older than X days" do
46
46
  Search.destroy_all
@@ -65,9 +65,9 @@ describe Search do
65
65
  saved_search_past.created_at = Date.today - (days_old + 1).days
66
66
  saved_search_past.save
67
67
 
68
- lambda do
68
+ expect do
69
69
  Search.delete_old_searches(days_old)
70
- end.should change(Search, :count).by(-1)
70
+ end.to change(Search, :count).by(-1)
71
71
  end
72
72
 
73
73
  end
@@ -52,22 +52,22 @@ end
52
52
 
53
53
  describe "new" do
54
54
  it "should take a Hash as the argument" do
55
- lambda { SolrDocument.new(@hash_with_marcxml) }.should_not raise_error
55
+ expect { SolrDocument.new(@hash_with_marcxml) }.not_to raise_error
56
56
  end
57
57
  end
58
58
 
59
59
  describe "access methods" do
60
60
 
61
61
  it "should have the right value for title_display" do
62
- @solrdoc[:title_display].should_not be_nil
62
+ expect(@solrdoc[:title_display]).not_to be_nil
63
63
  end
64
64
 
65
65
  it "should have the right value for format" do
66
- @solrdoc[:format][0].should == 'Book'
66
+ expect(@solrdoc[:format][0]).to eq('Book')
67
67
  end
68
68
 
69
69
  it "should provide the item's solr id" do
70
- @solrdoc.id.should == '00282214'
70
+ expect(@solrdoc.id).to eq('00282214')
71
71
  end
72
72
  end
73
73
 
@@ -76,8 +76,8 @@ end
76
76
  it "should have a valid to_marc" do
77
77
  @solrdoc = SolrDocument.new(@hash_with_marcxml)
78
78
 
79
- @solrdoc.should respond_to(:to_marc)
80
- @solrdoc.to_marc.should be_kind_of(MARC::Record)
79
+ expect(@solrdoc).to respond_to(:to_marc)
80
+ expect(@solrdoc.to_marc).to be_kind_of(MARC::Record)
81
81
  end
82
82
 
83
83
  it "should not try to create marc for objects w/out stored marc (marcxml test only at this time)" do
@@ -85,7 +85,7 @@ end
85
85
  # sure everything fails gracefully
86
86
  @hash_without_marcxml = get_hash_without_marcxml['response']['docs'][0]
87
87
  @solrdoc_without_marc = SolrDocument.new(@hash_without_marcxml)
88
- @solrdoc_without_marc.should_not respond_to(:to_marc)
88
+ expect(@solrdoc_without_marc).not_to respond_to(:to_marc)
89
89
  # legacy check
90
90
  # @solrdoc_without_marc.should respond_to(:marc)
91
91
  # @solrdoc_without_marc.marc.should == nil
@@ -6,11 +6,11 @@ describe "controllers that are not catalog controller" do
6
6
  it "should have the correct search form" do
7
7
  pending
8
8
  visit alternate_index_path
9
- page.should have_selector("form[action='#{alternate_index_path}']")
9
+ expect(page).to have_selector("form[action='#{alternate_index_path}']")
10
10
  fill_in "q", :with=>"history"
11
11
  click_button 'search'
12
12
  # page.should have_link("startOverLink", :href=>alternate_index_path)
13
- page.should have_selector("form.per_page[action='#{alternate_index_path}']")
14
- page.should have_selector("form.sort[action='#{alternate_index_path}']")
13
+ expect(page).to have_selector("form.per_page[action='#{alternate_index_path}']")
14
+ expect(page).to have_selector("form.sort[action='#{alternate_index_path}']")
15
15
  end
16
16
  end
@@ -4,50 +4,45 @@ describe "Routing" do
4
4
  describe "Paths Generated by Custom Routes:" do
5
5
  # paths generated by custom routes
6
6
  it "should have a path for showing the email form" do
7
- { :get => "/catalog/email" }.should route_to(:controller => 'catalog', :action => 'email')
7
+ expect({ :get => "/catalog/email" }).to route_to(:controller => 'catalog', :action => 'email')
8
8
  end
9
9
  it "should have a path for sending the email" do
10
- { :post => "/catalog/email" }.should route_to(:controller => 'catalog', :action => 'email')
10
+ expect({ :post => "/catalog/email" }).to route_to(:controller => 'catalog', :action => 'email')
11
11
  end
12
12
  it "should map {:controller => 'catalog', :action => 'sms'} to /catalog/sms" do
13
- { :get => "/catalog/sms" }.should route_to(:controller => 'catalog', :action => 'sms')
13
+ expect({ :get => "/catalog/sms" }).to route_to(:controller => 'catalog', :action => 'sms')
14
14
  end
15
15
  it "should map { :controller => 'catalog', :action => 'show', :id => 666 } to /catalog/666" do
16
- { :get => "/catalog/666" }.should route_to(:controller => 'catalog', :action => 'show', :id => "666")
16
+ expect({ :get => "/catalog/666" }).to route_to(:controller => 'catalog', :action => 'show', :id => "666")
17
17
  end
18
18
  it "should map {:controller => 'catalog', :id => '111', :action => 'librarian_view'} to /catalog/111/librarian_view" do
19
- { :get => "/catalog/111/librarian_view" }.should route_to(:controller => 'catalog', :action => 'librarian_view', :id => "111")
19
+ expect({ :get => "/catalog/111/librarian_view" }).to route_to(:controller => 'catalog', :action => 'librarian_view', :id => "111")
20
20
  end
21
21
  end
22
22
 
23
23
 
24
24
  describe "catalog_path for SolrDocument", :test => true do
25
25
  it "should route correctly" do
26
- { :get => catalog_path(SolrDocument.new(:id => 'asdf')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'asdf')
26
+ expect({ :get => catalog_path(SolrDocument.new(:id => 'asdf')) }).to route_to(:controller => 'catalog', :action => 'show', :id => 'asdf')
27
27
  end
28
28
 
29
29
  context "should escape solr document ids" do
30
30
 
31
31
  it "should pass-through url-valid ids" do
32
- { :get => catalog_path(SolrDocument.new(:id => 'qwerty'))}.should route_to(:controller => 'catalog', :action => 'show', :id => 'qwerty')
32
+ expect({ :get => catalog_path(SolrDocument.new(:id => 'qwerty'))}).to route_to(:controller => 'catalog', :action => 'show', :id => 'qwerty')
33
33
  end
34
34
 
35
35
  it "should route url-like ids" do
36
36
  pending "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
37
- { :get => catalog_path(SolrDocument.new(:id => 'http://example.com'))}.should route_to(:controller => 'catalog', :action => 'show', :id => 'http://example.com')
37
+ expect({ :get => catalog_path(SolrDocument.new(:id => 'http://example.com'))}).to route_to(:controller => 'catalog', :action => 'show', :id => 'http://example.com')
38
38
  end
39
39
 
40
40
  it "should route ids with whitespace" do
41
- { :get => catalog_path(SolrDocument.new(:id => 'mm 123')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'mm 123')
41
+ expect({ :get => catalog_path(SolrDocument.new(:id => 'mm 123')) }).to route_to(:controller => 'catalog', :action => 'show', :id => 'mm 123')
42
42
  end
43
43
 
44
44
  it "should route ids with a literal '+'" do
45
- { :get => catalog_path(SolrDocument.new(:id => 'this+that')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'this+that')
46
- end
47
-
48
- it "should route ids with a literal '/" do
49
- pending "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
50
- { :get => catalog_path(SolrDocument.new(:id => 'and/or')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'and/or')
45
+ expect({ :get => catalog_path(SolrDocument.new(:id => 'this+that')) }).to route_to(:controller => 'catalog', :action => 'show', :id => 'this+that')
51
46
  end
52
47
  end
53
48
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  # This file is copied to spec/ when you run 'rails generate rspec:install'
3
3
  # Has been customized by Blacklight to work when application is in one place,
4
- # and actual spec/ stuff is in another (the blacklight gem checkout).
4
+ # and actual spec/ stuff is in another (the blacklight gem checkout).
5
5
 
6
6
  ENV["RAILS_ENV"] ||= 'test'
7
7
 
@@ -23,7 +23,7 @@ require 'rspec/rails'
23
23
  require 'capybara/rspec'
24
24
  require 'capybara/poltergeist'
25
25
 
26
-
26
+ Capybara.server = :webrick
27
27
  Capybara.javascript_driver = :poltergeist
28
28
 
29
29
  Capybara.register_driver :poltergeist do |app|
@@ -36,8 +36,8 @@ end
36
36
 
37
37
  # Requires supporting ruby files with custom matchers and macros, etc,
38
38
  # in spec/support/ and its subdirectories.
39
- # Blacklight, again, make sure we're looking in the right place for em.
40
- # Relative to HERE, NOT to Rails.root, which is off somewhere else.
39
+ # Blacklight, again, make sure we're looking in the right place for em.
40
+ # Relative to HERE, NOT to Rails.root, which is off somewhere else.
41
41
  Dir[Pathname.new(File.expand_path("../support/**/*.rb", __FILE__))].each {|f| require f}
42
42
 
43
43
  RSpec.configure do |config|
@@ -57,4 +57,6 @@ RSpec.configure do |config|
57
57
  # examples within a transaction, remove the following line or assign false
58
58
  # instead of true.
59
59
  config.use_transactional_fixtures = true
60
+
61
+ config.infer_spec_type_from_file_location!
60
62
  end
@@ -5,13 +5,13 @@ def assert_difference(executable, how_many = 1, &block)
5
5
  before = eval(executable)
6
6
  yield
7
7
  after = eval(executable)
8
- after.should == before + how_many
8
+ expect(after).to eq(before + how_many)
9
9
  end
10
10
 
11
11
  def assert_no_difference(executable, &block)
12
12
  before = eval(executable)
13
13
  yield
14
14
  after = eval(executable)
15
- after.should == before
15
+ expect(after).to eq(before)
16
16
  end
17
17
 
@@ -4,4 +4,15 @@ require File.expand_path("../features/session_helpers.rb", __FILE__)
4
4
 
5
5
  RSpec.configure do |config|
6
6
  config.include Features::SessionHelpers, type: :feature
7
+
8
+ # rspec-rails 3 will no longer automatically infer an example group's spec type
9
+ # from the file location. You can explicitly opt-in to the feature using this
10
+ # config option.
11
+ # To explicitly tag specs without using automatic inference, set the `:type`
12
+ # metadata manually:
13
+ #
14
+ # describe ThingsController, :type => :controller do
15
+ # # Equivalent to being in spec/controllers
16
+ # end
17
+ config.infer_spec_type_from_file_location!
7
18
  end
@@ -14,9 +14,9 @@ module Features
14
14
  email = "#{login}@#{login}.com"
15
15
  user = User.create(:email => email, :password => "password", :password_confirmation => "password")
16
16
  visit new_user_session_path
17
- fill_in("user_email", :with => email)
18
- fill_in("user_password", :with => "password")
19
- click_button("Sign in")
17
+ fill_in("user_email", :with => email)
18
+ fill_in("user_password", :with => "password")
19
+ click_button("Log in")
20
20
  end
21
21
  end
22
22
  end