Don't make design_doc_slug_cache and design_doc_fresh inheritable, because these settings should be specific to the class
This commit is contained in:
parent
14acd95444
commit
1ee82b714c
|
@ -7,6 +7,7 @@ module CouchRest
|
|||
end
|
||||
|
||||
module ClassMethods
|
||||
attr_accessor :design_doc_slug_cache, :design_doc_fresh
|
||||
|
||||
# Define a CouchDB view. The name of the view will be the concatenation
|
||||
# of <tt>by</tt> and the keys joined by <tt>_and_</tt>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
require File.join(FIXTURE_PATH, 'more', 'card')
|
||||
require File.join(FIXTURE_PATH, 'more', 'course')
|
||||
|
||||
# add a default value
|
||||
Card.property :bg_color, :default => '#ccc'
|
||||
|
@ -13,6 +14,15 @@ class DesignBusinessCard < BusinessCard
|
|||
property :bg_color, :default => '#eee'
|
||||
end
|
||||
|
||||
class OnlineCourse < Course; end
|
||||
|
||||
class Animal < CouchRest::ExtendedDocument
|
||||
use_database TEST_SERVER.default_database
|
||||
property :name
|
||||
view_by :name
|
||||
end
|
||||
|
||||
class Dog < Animal; end
|
||||
|
||||
describe "Subclassing an ExtendedDocument" do
|
||||
|
||||
|
@ -56,5 +66,17 @@ describe "Subclassing an ExtendedDocument" do
|
|||
DesignBusinessCard.new.bg_color.should == '#eee'
|
||||
end
|
||||
|
||||
it "should have a design doc slug based on the subclass name" do
|
||||
Course.refresh_design_doc
|
||||
OnlineCourse.design_doc_slug.should =~ /^OnlineCourse/
|
||||
end
|
||||
|
||||
it "should have a it's own design_doc_fresh" do
|
||||
Animal.refresh_design_doc
|
||||
Dog.design_doc_fresh.should_not == true
|
||||
Dog.refresh_design_doc
|
||||
Dog.design_doc_fresh.should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue