Refactoring tests and Validation callbacks
This commit is contained in:
parent
ea4325f5bf
commit
3579e0e334
|
@ -7,7 +7,6 @@ module CouchRest
|
||||||
include CouchRest::Model::Configuration
|
include CouchRest::Model::Configuration
|
||||||
include CouchRest::Model::Connection
|
include CouchRest::Model::Connection
|
||||||
include CouchRest::Model::Persistence
|
include CouchRest::Model::Persistence
|
||||||
include CouchRest::Model::Callbacks
|
|
||||||
include CouchRest::Model::DocumentQueries
|
include CouchRest::Model::DocumentQueries
|
||||||
include CouchRest::Model::Views
|
include CouchRest::Model::Views
|
||||||
include CouchRest::Model::DesignDoc
|
include CouchRest::Model::DesignDoc
|
||||||
|
@ -18,6 +17,7 @@ module CouchRest
|
||||||
include CouchRest::Model::PropertyProtection
|
include CouchRest::Model::PropertyProtection
|
||||||
include CouchRest::Model::Associations
|
include CouchRest::Model::Associations
|
||||||
include CouchRest::Model::Validations
|
include CouchRest::Model::Validations
|
||||||
|
include CouchRest::Model::Callbacks
|
||||||
include CouchRest::Model::Designs
|
include CouchRest::Model::Designs
|
||||||
include CouchRest::Model::CastedBy
|
include CouchRest::Model::CastedBy
|
||||||
include CouchRest::Model::Dirty
|
include CouchRest::Model::Dirty
|
||||||
|
|
|
@ -5,21 +5,23 @@ module CouchRest #:nodoc:
|
||||||
|
|
||||||
module Callbacks
|
module Callbacks
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
CALLBACKS = [
|
||||||
|
:before_validation, :after_validation,
|
||||||
|
:after_initialize,
|
||||||
|
:before_create, :around_create, :after_create,
|
||||||
|
:before_destroy, :around_destroy, :after_destroy,
|
||||||
|
:before_save, :around_save, :after_save,
|
||||||
|
:before_update, :around_update, :after_update,
|
||||||
|
]
|
||||||
|
|
||||||
included do
|
included do
|
||||||
extend ActiveModel::Callbacks
|
extend ActiveModel::Callbacks
|
||||||
|
include ActiveModel::Validations::Callbacks
|
||||||
|
|
||||||
define_model_callbacks \
|
define_model_callbacks :initialize, :only => :after
|
||||||
:create,
|
define_model_callbacks :create, :destroy, :save, :update
|
||||||
:destroy,
|
|
||||||
:save,
|
|
||||||
:update
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid?(*) #nodoc
|
|
||||||
_run_validation_callbacks { super }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,11 +5,11 @@ module CouchRest::Model
|
||||||
|
|
||||||
included do
|
included do
|
||||||
include CouchRest::Model::Configuration
|
include CouchRest::Model::Configuration
|
||||||
include CouchRest::Model::Callbacks
|
|
||||||
include CouchRest::Model::Properties
|
include CouchRest::Model::Properties
|
||||||
include CouchRest::Model::PropertyProtection
|
include CouchRest::Model::PropertyProtection
|
||||||
include CouchRest::Model::Associations
|
include CouchRest::Model::Associations
|
||||||
include CouchRest::Model::Validations
|
include CouchRest::Model::Validations
|
||||||
|
include CouchRest::Model::Callbacks
|
||||||
include CouchRest::Model::CastedBy
|
include CouchRest::Model::CastedBy
|
||||||
include CouchRest::Model::Dirty
|
include CouchRest::Model::Dirty
|
||||||
class_eval do
|
class_eval do
|
||||||
|
|
|
@ -13,22 +13,33 @@ module CouchRest
|
||||||
# Validations may be applied to both Model::Base and Model::CastedModel
|
# Validations may be applied to both Model::Base and Model::CastedModel
|
||||||
module Validations
|
module Validations
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
included do
|
include ActiveModel::Validations
|
||||||
include ActiveModel::Validations
|
|
||||||
include ActiveModel::Validations::Callbacks
|
# Determine if the document is valid.
|
||||||
|
#
|
||||||
|
# @example Is the document valid?
|
||||||
|
# person.valid?
|
||||||
|
#
|
||||||
|
# @example Is the document valid in a context?
|
||||||
|
# person.valid?(:create)
|
||||||
|
#
|
||||||
|
# @param [ Symbol ] context The optional validation context.
|
||||||
|
#
|
||||||
|
# @return [ true, false ] True if valid, false if not.
|
||||||
|
#
|
||||||
|
def valid?(context = nil)
|
||||||
|
super context ? context : (new? ? :create : :update)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
||||||
# Validates the associated casted model. This method should not be
|
# Validates the associated casted model. This method should not be
|
||||||
# used within your code as it is automatically included when a CastedModel
|
# used within your code as it is automatically included when a CastedModel
|
||||||
# is used inside the model.
|
# is used inside the model.
|
||||||
#
|
|
||||||
def validates_casted_model(*args)
|
def validates_casted_model(*args)
|
||||||
validates_with(CastedModelValidator, _merge_attributes(args))
|
validates_with(CastedModelValidator, _merge_attributes(args))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Validates if the field is unique for this type of document. Automatically creates
|
# Validates if the field is unique for this type of document. Automatically creates
|
||||||
# a view if one does not already exist and performs a search for all matching
|
# a view if one does not already exist and performs a search for all matching
|
||||||
# documents.
|
# documents.
|
||||||
|
|
|
@ -60,8 +60,8 @@ require "couchrest/model/core_extensions/time_parsing"
|
||||||
# Base libraries
|
# Base libraries
|
||||||
require "couchrest/model/casted_model"
|
require "couchrest/model/casted_model"
|
||||||
require "couchrest/model/base"
|
require "couchrest/model/base"
|
||||||
# Add rails support *after* everything has loaded
|
|
||||||
|
|
||||||
|
# Add rails support *after* everything has loaded
|
||||||
if defined?(Rails)
|
if defined?(Rails)
|
||||||
require "couchrest/railtie"
|
require "couchrest/railtie"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'person'
|
||||||
|
|
||||||
class Card < CouchRest::Model::Base
|
class Card < CouchRest::Model::Base
|
||||||
# Set the default database to use
|
# Set the default database to use
|
||||||
use_database DB
|
use_database DB
|
|
@ -1,5 +1,5 @@
|
||||||
require File.join(FIXTURE_PATH, 'more', 'question')
|
require 'question'
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
require 'person'
|
||||||
|
|
||||||
class Course < CouchRest::Model::Base
|
class Course < CouchRest::Model::Base
|
||||||
use_database TEST_SERVER.default_database
|
use_database TEST_SERVER.default_database
|
|
@ -6,9 +6,9 @@ class Invoice < CouchRest::Model::Base
|
||||||
property :client_name
|
property :client_name
|
||||||
property :employee_name
|
property :employee_name
|
||||||
property :location
|
property :location
|
||||||
|
|
||||||
# Validation
|
# Validation
|
||||||
validates_presence_of :client_name, :employee_name
|
validates_presence_of :client_name, :employee_name
|
||||||
validates_presence_of :location, :message => "Hey stupid!, you forgot the location"
|
validates_presence_of :location, :message => "Hey stupid!, you forgot the location"
|
||||||
|
|
||||||
end
|
end
|
4
spec/fixtures/models/membership.rb
vendored
Normal file
4
spec/fixtures/models/membership.rb
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class Membership < Hash
|
||||||
|
include CouchRest::Model::CastedModel
|
||||||
|
|
||||||
|
end
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'cat'
|
||||||
|
|
||||||
class Person < Hash
|
class Person < Hash
|
||||||
include ::CouchRest::Model::CastedModel
|
include ::CouchRest::Model::CastedModel
|
||||||
property :pet, Cat
|
property :pet, Cat
|
|
@ -1,5 +1,6 @@
|
||||||
require File.join(FIXTURE_PATH, 'more', 'client')
|
require 'client'
|
||||||
require File.join(FIXTURE_PATH, 'more', 'sale_entry')
|
require 'sale_entry'
|
||||||
|
|
||||||
class SaleInvoice < CouchRest::Model::Base
|
class SaleInvoice < CouchRest::Model::Base
|
||||||
use_database DB
|
use_database DB
|
||||||
|
|
||||||
|
@ -10,4 +11,4 @@ class SaleInvoice < CouchRest::Model::Base
|
||||||
|
|
||||||
property :date, Date
|
property :date, Date
|
||||||
property :price, Integer
|
property :price, Integer
|
||||||
end
|
end
|
8
spec/functional/validations_spec.rb
Normal file
8
spec/functional/validations_spec.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
require File.expand_path('../../spec_helper', __FILE__)
|
||||||
|
|
||||||
|
describe CouchRest::Model::Validations do
|
||||||
|
|
||||||
|
let(:invoice) do
|
||||||
|
Invoice.new()
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,9 +1,14 @@
|
||||||
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
||||||
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
||||||
|
|
||||||
|
MODELS = File.join(File.dirname(__FILE__), "fixtures", "models")
|
||||||
|
$LOAD_PATH.unshift(MODELS)
|
||||||
|
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
require "rspec" # Satisfies Autotest and anyone else not using the Rake tasks
|
require "rspec"
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), '..','lib','couchrest_model')
|
require 'couchrest_model'
|
||||||
# check the following file to see how to use the spec'd features.
|
|
||||||
|
|
||||||
unless defined?(FIXTURE_PATH)
|
unless defined?(FIXTURE_PATH)
|
||||||
FIXTURE_PATH = File.join(File.dirname(__FILE__), '/fixtures')
|
FIXTURE_PATH = File.join(File.dirname(__FILE__), '/fixtures')
|
||||||
|
@ -16,6 +21,21 @@ unless defined?(FIXTURE_PATH)
|
||||||
DB = TEST_SERVER.database(TESTDB)
|
DB = TEST_SERVER.database(TESTDB)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.before(:all) { reset_test_db! }
|
||||||
|
|
||||||
|
config.after(:all) do
|
||||||
|
cr = TEST_SERVER
|
||||||
|
test_dbs = cr.databases.select { |db| db =~ /^#{TESTDB}/ }
|
||||||
|
test_dbs.each do |db|
|
||||||
|
cr.database(db).delete! rescue nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Require each of the fixture models
|
||||||
|
Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require File.basename(file) }
|
||||||
|
|
||||||
class Basic < CouchRest::Model::Base
|
class Basic < CouchRest::Model::Base
|
||||||
use_database TEST_SERVER.default_database
|
use_database TEST_SERVER.default_database
|
||||||
end
|
end
|
||||||
|
@ -27,17 +47,6 @@ def reset_test_db!
|
||||||
DB
|
DB
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
config.before(:all) { reset_test_db! }
|
|
||||||
|
|
||||||
config.after(:all) do
|
|
||||||
cr = TEST_SERVER
|
|
||||||
test_dbs = cr.databases.select { |db| db =~ /^#{TESTDB}/ }
|
|
||||||
test_dbs.each do |db|
|
|
||||||
cr.database(db).delete! rescue nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def couchdb_lucene_available?
|
def couchdb_lucene_available?
|
||||||
lucene_path = "http://localhost:5985/"
|
lucene_path = "http://localhost:5985/"
|
||||||
|
|
30
spec/unit/active_model_lint_spec.rb
Normal file
30
spec/unit/active_model_lint_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
require 'spec_helper'
|
||||||
|
require 'test/unit/assertions'
|
||||||
|
require 'active_model/lint'
|
||||||
|
|
||||||
|
class CompliantModel < CouchRest::Model::Base
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe CouchRest::Model::Base do
|
||||||
|
include Test::Unit::Assertions
|
||||||
|
include ActiveModel::Lint::Tests
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
@model = CompliantModel.new
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "active model lint tests" do
|
||||||
|
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
|
||||||
|
example m.gsub('_',' ') do
|
||||||
|
send m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def model
|
||||||
|
@model
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,7 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
require File.join(FIXTURE_PATH, 'more', 'sale_invoice')
|
|
||||||
|
|
||||||
|
|
||||||
describe "Assocations" do
|
describe "Assocations" do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
|
|
||||||
describe "Model attachments" do
|
describe "Model attachments" do
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
require "spec_helper"
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'base')
|
|
||||||
|
|
||||||
describe "Model Base" do
|
describe "Model Base" do
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
require "spec_helper"
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'question')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
|
|
||||||
|
|
||||||
class WithCastedModelMixin < Hash
|
class WithCastedModelMixin < Hash
|
||||||
include CouchRest::Model::CastedModel
|
include CouchRest::Model::CastedModel
|
|
@ -1,7 +1,4 @@
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require "spec_helper"
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
|
|
||||||
class Driver < CouchRest::Model::Base
|
class Driver < CouchRest::Model::Base
|
||||||
use_database TEST_SERVER.default_database
|
use_database TEST_SERVER.default_database
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
class UnattachedDoc < CouchRest::Model::Base
|
class UnattachedDoc < CouchRest::Model::Base
|
||||||
# Note: no use_database here
|
# Note: no use_database here
|
|
@ -1,5 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
|
|
||||||
describe "Collections" do
|
describe "Collections" do
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require "spec_helper"
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
|
|
||||||
describe CouchRest::Model::Base do
|
describe CouchRest::Model::Configuration do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@class = Class.new(CouchRest::Model::Base)
|
@class = Class.new(CouchRest::Model::Base)
|
|
@ -1,7 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
|
|
||||||
describe CouchRest::Model::Base do
|
describe CouchRest::Model::Connection do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@class = Class.new(CouchRest::Model::Base)
|
@class = Class.new(CouchRest::Model::Base)
|
|
@ -1,10 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
describe CouchRest::Model::DesignDoc do
|
||||||
require File.join(FIXTURE_PATH, 'base')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
|
|
||||||
describe "Design Documents" do
|
|
||||||
|
|
||||||
before :all do
|
before :all do
|
||||||
reset_test_db!
|
reset_test_db!
|
|
@ -1,10 +1,9 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
class DesignModel < CouchRest::Model::Base
|
class DesignModel < CouchRest::Model::Base
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Design" do
|
describe CouchRest::Model::Designs do
|
||||||
|
|
||||||
it "should accessable from model" do
|
it "should accessable from model" do
|
||||||
DesignModel.respond_to?(:design).should be_true
|
DesignModel.respond_to?(:design).should be_true
|
|
@ -1,10 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'base')
|
|
||||||
|
|
||||||
class WithCastedModelMixin < Hash
|
class WithCastedModelMixin < Hash
|
||||||
include CouchRest::Model::CastedModel
|
include CouchRest::Model::CastedModel
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
|
|
||||||
class PlainParent
|
class PlainParent
|
||||||
class_inheritable_accessor :foo
|
class_inheritable_accessor :foo
|
|
@ -1,13 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
require File.join(FIXTURE_PATH, 'base')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'event')
|
|
||||||
|
|
||||||
describe "Model Persistence" do
|
describe CouchRest::Model::Persistence do
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@obj = WithDefaultValues.new
|
@obj = WithDefaultValues.new
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
describe "Model Attributes" do
|
describe "Model Attributes" do
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'invoice')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'service')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'event')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'user')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
require File.join(FIXTURE_PATH, "more", "key_chain")
|
|
||||||
|
|
||||||
|
describe CouchRest::Model::Property do
|
||||||
describe "Model properties" do
|
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
reset_test_db!
|
reset_test_db!
|
|
@ -1,6 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
|
|
||||||
class DummyProxyable < CouchRest::Model::Base
|
class DummyProxyable < CouchRest::Model::Base
|
||||||
proxy_database_method :db
|
proxy_database_method :db
|
||||||
|
@ -12,7 +10,7 @@ end
|
||||||
class ProxyKitten < CouchRest::Model::Base
|
class ProxyKitten < CouchRest::Model::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Proxyable" do
|
describe CouchRest::Model::Proxyable do
|
||||||
|
|
||||||
describe "#proxy_database" do
|
describe "#proxy_database" do
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
|
|
||||||
# add a default value
|
# add a default value
|
||||||
Card.property :bg_color, :default => '#ccc'
|
Card.property :bg_color, :default => '#ccc'
|
|
@ -1,8 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
require File.expand_path('../../spec_helper', __FILE__)
|
require 'spec_helper'
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
|
|
||||||
describe "Type Casting" do
|
describe "Type Casting" do
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
describe CouchRest::Model::Validations do
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
|
||||||
require File.join(FIXTURE_PATH, 'base')
|
|
||||||
|
|
||||||
# TODO Move validations from other specs to here
|
|
||||||
|
|
||||||
describe "Validations" do
|
|
||||||
|
|
||||||
describe "Uniqueness" do
|
describe "Uniqueness" do
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
require File.expand_path("../../spec_helper", __FILE__)
|
require "spec_helper"
|
||||||
require File.join(FIXTURE_PATH, 'more', 'cat')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'person')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'article')
|
|
||||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
|
||||||
|
|
||||||
describe "Model views" do
|
describe CouchRest::Model::Views do
|
||||||
|
|
||||||
class Unattached < CouchRest::Model::Base
|
class Unattached < CouchRest::Model::Base
|
||||||
property :title
|
property :title
|
||||||
|
@ -17,7 +13,6 @@ describe "Model views" do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
describe "ClassMethods" do
|
describe "ClassMethods" do
|
||||||
# NOTE! Add more unit tests!
|
# NOTE! Add more unit tests!
|
Loading…
Reference in a new issue