2010-05-10 21:19:24 +02:00
|
|
|
require File.expand_path('../../spec_helper', __FILE__)
|
2010-02-27 01:39:09 +01:00
|
|
|
|
|
|
|
begin
|
|
|
|
require 'rubygems' unless ENV['SKIP_RUBYGEMS']
|
2010-06-15 01:24:31 +02:00
|
|
|
require 'active_support/json'
|
2010-02-27 01:39:09 +01:00
|
|
|
ActiveSupport::JSON.backend = :JSONGem
|
|
|
|
|
|
|
|
class PlainParent
|
|
|
|
class_inheritable_accessor :foo
|
|
|
|
self.foo = :bar
|
|
|
|
end
|
|
|
|
|
|
|
|
class PlainChild < PlainParent
|
|
|
|
end
|
|
|
|
|
2010-06-20 22:01:11 +02:00
|
|
|
class ExtendedParent < CouchRest::Model::Base
|
2010-02-27 01:39:09 +01:00
|
|
|
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
|
2010-06-15 01:24:31 +02:00
|
|
|
puts "This spec requires 'active_support/json' to be loaded"
|
2010-02-27 01:39:09 +01:00
|
|
|
end
|