Sha256: e5c34492cbc442a078d8ba93dd3eb1d54338704fbf7ac0bf37d53a628cb243e8

Contents?: true

Size: 979 Bytes

Versions: 8

Compression:

Stored size: 979 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

begin
  require 'rubygems' unless ENV['SKIP_RUBYGEMS']  
  require 'active_support/json'
  ActiveSupport::JSON.backend = :JSONGem

  class PlainParent
    class_inheritable_accessor :foo
    self.foo = :bar
  end

  class PlainChild < PlainParent
  end

  class ExtendedParent < CouchRest::Model::Base
    class_inheritable_accessor :foo
    self.foo = :bar
  end

  class ExtendedChild < ExtendedParent
  end

  describe "Using chained inheritance without CouchRest::Model::Base" do
    it "should preserve inheritable attributes" do
      PlainParent.foo.should == :bar
      PlainChild.foo.should == :bar
    end
  end

  describe "Using chained inheritance with CouchRest::Model::Base" 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/json' to be loaded"
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
couchrest_model-1.1.0.beta5 spec/couchrest/inherited_spec.rb
couchrest_model-1.1.0.beta4 spec/couchrest/inherited_spec.rb
couchrest_model-1.1.0.beta3 spec/couchrest/inherited_spec.rb
couchrest_model-1.1.0.beta2 spec/couchrest/inherited_spec.rb
couchrest_model-1.1.0.beta spec/couchrest/inherited_spec.rb
couchrest_model-1.0.0 spec/couchrest/inherited_spec.rb
couchrest_model-radiant-1.0.0 spec/couchrest/inherited_spec.rb
couchrest_model-1.0.0.beta8 spec/couchrest/inherited_spec.rb