Sha256: 43b1d4fb714fe1f8870ce2da9984d43dfe143082aa103df772c830178c71065e
Contents?: true
Size: 960 Bytes
Versions: 3
Compression:
Stored size: 960 Bytes
Contents
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper") require 'yaml' describe "serialization_modification_detection plugin" do before do @c = Class.new(Sequel::Model(:items)) @c.class_eval do columns :id, :h plugin :serialization, :yaml, :h plugin :serialization_modification_detection end @o1 = @c.new @o2 = @c.load(:id=>1, :h=>"--- {}\n\n") MODEL_DB.reset end it "should not detect columns that haven't been changed" do @o2.changed_columns.should == [] @o2.h.should == {} @o2.h[1] = 2 @o2.h.clear @o2.changed_columns.should == [] end it "should detect columns that have been changed" do @o2.changed_columns.should == [] @o2.h.should == {} @o2.h[1] = 2 @o2.changed_columns.should == [:h] end it "should report correct changed_columns after saving" do @o2.h[1] = 2 @o2.save_changes @o2.changed_columns.should == [] end end
Version data entries
3 entries across 3 versions & 1 rubygems