spec/ripple/validations_spec.rb in ripple-0.5.0 vs spec/ripple/validations_spec.rb in ripple-0.5.1

- old
+ new

@@ -13,11 +13,11 @@ # limitations under the License. require File.expand_path("../../spec_helper", __FILE__) describe Ripple::Document::Validations do before :all do - class Box; include Ripple::Document; property :shape, String end + Object.module_eval { class Box; include Ripple::Document; property :shape, String end } end before :each do @box = Box.new end @@ -48,17 +48,19 @@ @box.should_not be_valid Box.properties.delete :size end it "should run validations at the correct lifecycle state" do - pending "@_on_validate seems not to work?!" - Box.property :size, Integer - Box.validates_inclusion_of :size, :in => 1..30, :on => :update + Box.property :size, Integer, :inclusion => {:in => 1..30, :on => :update } @box.size = 0 @box.should be_valid Box.properties.delete :size end - + + after :each do + Box.reset_callbacks(:validate) + end + after :all do Object.send(:remove_const, :Box) end end