spec/fixtures/models/base.rb in couchrest_model-1.1.2 vs spec/fixtures/models/base.rb in couchrest_model-1.2.0.beta

- old
+ new

@@ -1,26 +1,26 @@ class WithDefaultValues < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB property :preset, Object, :default => {:right => 10, :top_align => false} property :set_by_proc, Time, :default => Proc.new{Time.now} property :tags, [String], :default => [] property :read_only_with_default, :default => 'generic', :read_only => true property :default_false, TrueClass, :default => false property :name timestamps! end class WithSimplePropertyType < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB property :name, String property :preset, String, :default => 'none' property :tags, [String] timestamps! end class WithCallBacks < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB property :name property :run_before_validation property :run_after_validation property :run_before_save property :run_after_save @@ -83,31 +83,34 @@ end end # Following two fixture classes have __intentionally__ diffent syntax for setting the validation context class WithContextualValidationOnCreate < CouchRest::Model::Base + use_database DB property(:name, String) validates(:name, :presence => {:on => :create}) end class WithContextualValidationOnUpdate < CouchRest::Model::Base + use_database DB property(:name, String) validates(:name, :presence => true, :on => :update) end class WithTemplateAndUniqueID < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB unique_id do |model| model.slug end property :slug property :preset, :default => 'value' property :has_no_default + design end class WithGetterAndSetterMethods < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB property :other_arg def arg other_arg end @@ -116,11 +119,11 @@ self.other_arg = "foo-#{value}" end end class WithAfterInitializeMethod < CouchRest::Model::Base - use_database TEST_SERVER.default_database + use_database DB property :some_value def after_initialize self.some_value ||= "value" @@ -145,10 +148,11 @@ def code @code end property :title + design validates_uniqueness_of :code, :view => 'all' end class WithScopedUniqueValidation < CouchRest::Model::Base use_database DB @@ -157,6 +161,10 @@ property :title validates_uniqueness_of :title, :scope => :parent_id end - +class WithDateAndTime < CouchRest::Model::Base + use_database DB + property :exec_date, Date + property :exec_time, Time +end