Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add failing test

  • Loading branch information...
commit 21a8743946bcfe32ae4f4ff6ee49d4e76d41c022 1 parent 926a313
Michael Guterl authored
5 test/serialized_attributes_test.rb
@@ -238,6 +238,11 @@ def @record.title=(v)
238 238 assert !@record.data.key?('active')
239 239 end
240 240
  241 + test "ignores empty strings for booleans" do
  242 + @newbie.clearance = ""
  243 + assert_nil @newbie.clearance
  244 + end
  245 +
241 246 test "attempts to re-encode data when saving" do
242 247 assert_not_nil @record.title
243 248 @record.raw_data = nil
3  test/test_helper.rb
@@ -76,7 +76,8 @@ class SerializedRecordWithDefaults < ActiveRecord::Base
76 76 boolean :active, :default => true
77 77 array :names, :default => %w(a b c)
78 78 hash :extras, :default => {:a => 1}
  79 + boolean :clearance, :default => nil
79 80 end
80 81
81 82 before_save { |r| false } # cancel the save
82   -end
  83 +end

0 comments on commit 21a8743

Please sign in to comment.
Something went wrong with that request. Please try again.