test/shoden_test.rb in shoden-0.1.1 vs test/shoden_test.rb in shoden-0.2.0
- old
+ new
@@ -65,5 +65,16 @@
user.destroy
assert_raise(Shoden::NotFound) { User[id] }
end
+
+test 'casting' do
+ class A < Shoden::Model
+ attribute :n, ->(x) { x.to_i }
+ end
+
+ a = A.create(n: 1)
+ a_prime = A[a.id]
+
+ assert_equal a_prime.n, 1
+end