lucid_works 0.6.23 → 0.6.24

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.
@@ -94,5 +94,23 @@ module LucidWorks
94
94
  def initialize(options)
95
95
  super(options.reverse_merge(:omit_tf => false, :short_field_boost => 'high'))
96
96
  end
97
+
98
+ def update_attributes(attrs)
99
+ attrs = attrs.with_indifferent_access
100
+ if [false, '0'].include?(attrs[:stored])
101
+ attrs[:include_in_results] ||= false
102
+ attrs[:highlight] ||= false
103
+ end
104
+ if [false, '0'].include?(attrs[:indexed])
105
+ attrs[:facet] ||= false
106
+ attrs[:synonym_expansion] ||= false
107
+ attrs[:omit_tf] ||= false
108
+ attrs[:short_field_boost] ||= 'high'
109
+ attrs[:search_by_default] ||= false
110
+ attrs[:use_in_find_similar] ||= false
111
+ attrs[:query_time_stopword_handling] ||= false
112
+ end
113
+ super(attrs)
114
+ end
97
115
  end
98
116
  end
@@ -1,3 +1,3 @@
1
1
  module LucidWorks
2
- VERSION = "0.6.23"
2
+ VERSION = "0.6.24"
3
3
  end
@@ -12,10 +12,50 @@ describe LucidWorks::Field do
12
12
  end
13
13
 
14
14
  describe "default attribute values" do
15
- subject { LucidWorks::Field.new(:parent => @collection) }
15
+ context "for a new field" do
16
+ subject { LucidWorks::Field.new(:parent => @collection) }
17
+
18
+ it { subject.omit_tf.should be_false }
19
+ it { subject.short_field_boost.should == 'high' }
20
+ end
16
21
 
17
- it { subject.omit_tf.should be_false }
18
- it { subject.short_field_boost.should == 'high' }
22
+ context "on update" do
23
+ before(:each) do
24
+ subject.persisted = true
25
+ subject.stub(:save)
26
+ end
27
+
28
+ subject {
29
+ LucidWorks::Field.new(
30
+ :parent => @collection,
31
+ :indexed => true, :facet => true, :synonym_expansion => true, :omit_tf => true, :short_field_boost => true, :search_by_default => false, :use_in_find_similar => false, :query_time_stopword_handling => false,
32
+ :stored => true, :include_in_results => true, :highlight => true
33
+ )
34
+ }
35
+
36
+ context "when indexed is set to false" do
37
+ before(:each) do
38
+ subject.update_attributes(:indexed => false)
39
+ end
40
+
41
+ it { subject.facet.should be_false }
42
+ it { subject.synonym_expansion.should be_false }
43
+ it { subject.omit_tf.should be_false }
44
+ it { subject.short_field_boost.should == 'high' }
45
+ it { subject.search_by_default.should be_false }
46
+ it { subject.use_in_find_similar.should be_false }
47
+ it { subject.query_time_stopword_handling.should be_false }
48
+ end
49
+
50
+ context "when stored is set to false" do
51
+ before(:each) do
52
+ subject.update_attributes(:stored => false)
53
+ end
54
+
55
+ it { subject.include_in_results.should be_false }
56
+ it { subject.highlight.should be_false }
57
+ end
58
+ end
19
59
  end
20
60
 
21
61
  describe "validations" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: lucid_works
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.23
5
+ version: 0.6.24
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sam Pierson