test/helper.rb in property_sets-2.0.1 vs test/helper.rb in property_sets-2.1.0

- old
+ new

@@ -1,14 +1,31 @@ require 'rubygems' require 'bundler' Bundler.setup -require 'active_support' + require 'test/unit' + +begin + require 'mocha/setup' +rescue LoadError + require 'mocha' +end + +require 'active_support' +require 'active_support/core_ext' require 'active_record' require 'active_record/fixtures' require 'shoulda' +if ActiveRecord::VERSION::MAJOR > 2 && ActiveRecord::VERSION::MAJOR < 4 + if ActiveRecord::VERSION::MINOR > 1 + ActiveRecord::Base.mass_assignment_sanitizer = :strict + end + + ActiveRecord::Base.attr_accessible +end + require File.expand_path "../database", __FILE__ $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'property_sets' @@ -35,10 +52,15 @@ 123 end end class Account < ActiveRecord::Base + if ActiveRecord::VERSION::MAJOR < 4 + attr_accessible :name + attr_accessible :texts_attributes + end + property_set :settings do property :foo property :bar property :baz property :hep, :default => 'skep' @@ -47,9 +69,10 @@ property_set :texts do property :foo property :bar end + accepts_nested_attributes_for :texts property_set :validations do property :validated property :regular