blacklight 5.0.0.pre4 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe BlacklightConfigurationHelper do
4
+ let(:blacklight_config) { Blacklight::Configuration.new }
5
+ let(:config_value) { double() }
6
+
7
+ before :each do
8
+ helper.stub(blacklight_config: blacklight_config)
9
+ end
10
+
11
+ describe "#index_fields" do
12
+ it "should pass through the configuration" do
13
+ blacklight_config.stub(index_fields: config_value)
14
+ expect(helper.index_fields).to eq config_value
15
+ end
16
+ end
17
+
18
+ describe "#sort_fields" do
19
+ it "should convert the sort fields to select-ready values" do
20
+ blacklight_config.stub(sort_fields: { 'a' => double(key: 'a', label: 'a'), 'b' => double(key: 'b', label: 'b'), })
21
+ expect(helper.sort_fields).to eq [['a', 'a'], ['b', 'b']]
22
+ end
23
+ end
24
+
25
+ describe "#document_show_fields" do
26
+ it "should pass through the configuration" do
27
+ blacklight_config.stub(show_fields: config_value)
28
+ expect(helper.document_show_fields).to eq config_value
29
+ end
30
+ end
31
+
32
+ describe "#default_document_index_view_type" do
33
+ it "should be the first configured index view" do
34
+ blacklight_config.stub(view: { 'a' => true, 'b' => true})
35
+ expect(helper.default_document_index_view_type).to eq 'a'
36
+ end
37
+ end
38
+
39
+ describe "#has_alternative_views?" do
40
+ subject { helper.has_alternative_views?}
41
+ describe "with a single view defined" do
42
+ it { should be_false }
43
+ end
44
+
45
+ describe "with multiple views defined" do
46
+ before do
47
+ blacklight_config.view.abc
48
+ blacklight_config.view.xyz
49
+ end
50
+
51
+ it { should be_true }
52
+ end
53
+ end
54
+
55
+ describe "#spell_check_max" do
56
+ it "should pass through the configuration" do
57
+ blacklight_config.stub(spell_max: config_value)
58
+ expect(helper.spell_check_max).to eq config_value
59
+ end
60
+ end
61
+ end
@@ -225,6 +225,13 @@ describe BlacklightHelper do
225
225
  @document = SolrDocument.new('id'=>'123456')
226
226
  expect(link_to_document(@document,:label=>"Some crazy long label...")).to_not match(/title=/)
227
227
  end
228
+
229
+ it "should work with integer ids" do
230
+ data = {'id'=> 123456 }
231
+ @document = SolrDocument.new(data)
232
+ expect(link_to_document(@document)).to have_selector("a")
233
+ end
234
+
228
235
  end
229
236
 
230
237
  describe "link_to_previous_search" do
@@ -44,6 +44,14 @@ describe "Blacklight::Solr::Document" do
44
44
  @document = MockDocument.new :id => 'asdf', :my_unique_key => '1234'
45
45
  expect(@document.id).to eq '1234'
46
46
  end
47
+
48
+ end
49
+
50
+ describe "#to_param" do
51
+ it "should be a string" do
52
+ @document = MockDocument.new :id => 1234
53
+ expect(@document.to_param).to eq '1234'
54
+ end
47
55
  end
48
56
 
49
57
  context "Extendability" do
@@ -52,7 +52,7 @@ describe "catalog/_constraints_element.html.erb" do
52
52
 
53
53
  describe "with no escaping" do
54
54
  before do
55
- render( :partial => "catalog/constraints_element", :locals => {:label => "<span class='custom_label'>my label</span>", :value => "<span class='custom_value'>my value</span>", :options => {:escape_label => false, :escape_value => false}} )
55
+ render( :partial => "catalog/constraints_element", :locals => {:label => "<span class='custom_label'>my label</span>".html_safe, :value => "<span class='custom_value'>my value</span>".html_safe} )
56
56
  end
57
57
  it "should not escape key and value" do
58
58
  expect(rendered).to have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre4
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2014-02-02 00:00:00.000000000 Z
20
+ date: 2014-02-05 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -245,11 +245,13 @@ files:
245
245
  - app/controllers/search_history_controller.rb
246
246
  - app/helpers/blacklight/blacklight_helper_behavior.rb
247
247
  - app/helpers/blacklight/catalog_helper_behavior.rb
248
+ - app/helpers/blacklight/configuration_helper_behavior.rb
248
249
  - app/helpers/blacklight/facets_helper_behavior.rb
249
250
  - app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb
250
251
  - app/helpers/blacklight/render_constraints_helper_behavior.rb
251
252
  - app/helpers/blacklight/search_history_constraints_helper_behavior.rb
252
253
  - app/helpers/blacklight/url_helper_behavior.rb
254
+ - app/helpers/blacklight_configuration_helper.rb
253
255
  - app/helpers/blacklight_helper.rb
254
256
  - app/helpers/blacklight_url_helper.rb
255
257
  - app/helpers/catalog_helper.rb
@@ -389,6 +391,7 @@ files:
389
391
  - lib/generators/blacklight/models_generator.rb
390
392
  - lib/generators/blacklight/templates/alternate_controller.rb
391
393
  - lib/generators/blacklight/templates/blacklight.css.scss
394
+ - lib/generators/blacklight/templates/blacklight.en.yml
392
395
  - lib/generators/blacklight/templates/catalog_controller.rb
393
396
  - lib/generators/blacklight/templates/config/jetty.yml
394
397
  - lib/generators/blacklight/templates/config/solr.yml
@@ -416,6 +419,7 @@ files:
416
419
  - spec/features/search_spec.rb
417
420
  - spec/helpers/blacklight_helper_spec.rb
418
421
  - spec/helpers/catalog_helper_spec.rb
422
+ - spec/helpers/configuration_helper_spec.rb
419
423
  - spec/helpers/facets_helper_spec.rb
420
424
  - spec/helpers/hash_as_hidden_fields_spec.rb
421
425
  - spec/helpers/render_constraints_helper_spec.rb
@@ -488,9 +492,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
488
492
  version: '0'
489
493
  required_rubygems_version: !ruby/object:Gem::Requirement
490
494
  requirements:
491
- - - ">"
495
+ - - ">="
492
496
  - !ruby/object:Gem::Version
493
- version: 1.3.1
497
+ version: '0'
494
498
  requirements: []
495
499
  rubyforge_project:
496
500
  rubygems_version: 2.2.0
@@ -519,6 +523,7 @@ test_files:
519
523
  - spec/features/search_spec.rb
520
524
  - spec/helpers/blacklight_helper_spec.rb
521
525
  - spec/helpers/catalog_helper_spec.rb
526
+ - spec/helpers/configuration_helper_spec.rb
522
527
  - spec/helpers/facets_helper_spec.rb
523
528
  - spec/helpers/hash_as_hidden_fields_spec.rb
524
529
  - spec/helpers/render_constraints_helper_spec.rb