Permalink
Browse files

Updating histories and ensuring VERSION and date are good for 1.1.2

  • Loading branch information...
samlown committed Jul 23, 2011
2 parents 3258ac2 + 3f1b2ea commit 80e5ed27679a497df32917b79285ee5e0159e098
Showing with 14 additions and 11 deletions.
  1. +1 −1 VERSION
  2. +1 −1 couchrest_model.gemspec
  3. +2 −1 history.md
  4. +1 −2 lib/couchrest/model/property.rb
  5. +9 −6 spec/unit/property_spec.rb
View
@@ -1 +1 @@
-1.1.1
+1.1.2
View
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"]
- s.date = %q{2011-04-29}
+ s.date = File.mtime('VERSION')
s.description = %q{CouchRest Model provides aditional features to the standard CouchRest Document class such as properties, view designs, associations, callbacks, typecasting and validations.}
s.email = %q{jchris@apache.org}
s.extra_rdoc_files = [
View
@@ -1,10 +1,11 @@
# CouchRest Model Change History
-## 1.1.2 - 2011-07-XX
+## 1.1.2 - 2011-07-23
* Minor fixes
* Upgrade to couchrest 1.1.2
* Override as_couch_json to ensure nil values not stored
+ * Removing restriction that prohibited objects that cast as an array to be loaded.
## 1.1.1 - 2011-07-04
@@ -43,9 +43,8 @@ def cast(parent, value)
end
end
- # Cast an individual value, not an array
+ # Cast an individual value
def cast_value(parent, value)
- raise "An array inside an array cannot be casted, use Embeddable module" if value.is_a?(Array)
value = typecast_value(value, self)
associate_casted_value_to_parent(parent, value)
end
View
@@ -450,15 +450,18 @@
ary.last.should eql(Date.new(2011, 05, 22))
end
- it "should raise and error if value is array when type is not" do
- property = CouchRest::Model::Property.new(:test, Date)
+ it "should cast an object that provides an array" do
+ prop = Class.new do
+ attr_accessor :ary
+ def initialize(val); self.ary = val; end
+ def as_json; ary; end
+ end
+ property = CouchRest::Model::Property.new(:test, prop)
parent = mock("FooClass")
- lambda {
- cast = property.cast(parent, [Date.new(2010, 6, 1)])
- }.should raise_error
+ cast = property.cast(parent, [1, 2])
+ cast.ary.should eql([1, 2])
end
-
it "should set parent as casted_by object in CastedArray" do
property = CouchRest::Model::Property.new(:test, [Object])
parent = mock("FooObject")

0 comments on commit 80e5ed2

Please sign in to comment.