acts-as-optionable 0.4.0 → 0.4.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -18,7 +18,7 @@ module ActiveRecord
18
18
  # Store an option persistently and override default option
19
19
  def set_option(name, value, opts = {})
20
20
  option = get_stored_option(name) || options.build(:name => name.to_s, :value => value, :kind => opts[:kind], :display_name => opts[:display_name])
21
- return if new_option_matches_current?(option, value)
21
+ return if !opts[:force_set] && new_option_matches_current?(option, value)
22
22
  option.value = value
23
23
  ret = option.save!
24
24
  options(:reload)
@@ -223,6 +223,13 @@ describe "ActsAsOptionable" do
223
223
  @optionable.set_option(:foo, "FOOFOO")
224
224
  }.should_not change { Option.count }
225
225
  end
226
+
227
+ it "should set the option if it matches the default but you provide a true force_set option" do
228
+ @optionable.get_option(:foo).value.should == "FOOFOO"
229
+ lambda {
230
+ @optionable.set_option(:foo, "FOOFOO", :force_set => true)
231
+ }.should change { Option.count }.by(1)
232
+ end
226
233
  end
227
234
 
228
235
  describe "getting options" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 0
9
- version: 0.4.0
8
+ - 1
9
+ version: 0.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brendon Murphy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-30 00:00:00 -07:00
17
+ date: 2010-05-05 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20