Changing CouchRest::ExtendedDocument to allow chaining the inherit class callback
This commit is contained in:
parent
b1f4040a44
commit
17dac85a02
4 changed files with 45 additions and 2 deletions
40
spec/couchrest/more/extended_doc_inherited_spec.rb
Normal file
40
spec/couchrest/more/extended_doc_inherited_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
begin
|
||||
require 'rubygems' unless ENV['SKIP_RUBYGEMS']
|
||||
require 'activesupport'
|
||||
ActiveSupport::JSON.backend = :JSONGem
|
||||
|
||||
class PlainParent
|
||||
class_inheritable_accessor :foo
|
||||
self.foo = :bar
|
||||
end
|
||||
|
||||
class PlainChild < PlainParent
|
||||
end
|
||||
|
||||
class ExtendedParent < CouchRest::ExtendedDocument
|
||||
class_inheritable_accessor :foo
|
||||
self.foo = :bar
|
||||
end
|
||||
|
||||
class ExtendedChild < ExtendedParent
|
||||
end
|
||||
|
||||
describe "Using chained inheritance without CouchRest::ExtendedDocument" do
|
||||
it "should preserve inheritable attributes" do
|
||||
PlainParent.foo.should == :bar
|
||||
PlainChild.foo.should == :bar
|
||||
end
|
||||
end
|
||||
|
||||
describe "Using chained inheritance with CouchRest::ExtendedDocument" do
|
||||
it "should preserve inheritable attributes" do
|
||||
ExtendedParent.foo.should == :bar
|
||||
ExtendedChild.foo.should == :bar
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
puts "This spec requires 'active_support' to be loaded"
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue