Sha256: c785d01dc7ac4fabd8ec603a440f47311a4de81285dbc4b723ab7d90dd757126

Contents?: true

Size: 1.34 KB

Versions: 47

Compression:

Stored size: 1.34 KB

Contents

require "spec_helper"

describe ApiClient::Base do

  describe "subclasses" do

    it "inherit scopes, hooks, namespace and format" do

      class Level1InheritanceTest < ApiClient::Base
      end

      Level1InheritanceTest.default_scopes.should   == []
      Level1InheritanceTest.connection_hooks.should == []
      Level1InheritanceTest.namespace.should        == nil
      Level1InheritanceTest.format.should           == :json

      Level1InheritanceTest.default_scopes   = ['scope1']
      Level1InheritanceTest.connection_hooks = ['hook1']
      Level1InheritanceTest.namespace        'level1'
      Level1InheritanceTest.format           :xml

      ApiClient::Base.default_scopes.should   == []
      ApiClient::Base.connection_hooks.should == []
      ApiClient::Base.namespace.should        == nil
      ApiClient::Base.format.should           == :json

      class Level2InheritanceTest < Level1InheritanceTest
        namespace "level2"
        format    :yaml
      end

      Level2InheritanceTest.default_scopes.should   == ['scope1']
      Level2InheritanceTest.connection_hooks.should == ['hook1']
      Level2InheritanceTest.namespace.should        == 'level2'
      Level2InheritanceTest.format.should           == :yaml

      Level1InheritanceTest.namespace.should == 'level1'
      Level1InheritanceTest.format.should    == :xml

    end

  end

end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
api_client-0.6.0-java spec/api_client/base/inheritance_spec.rb
api_client-0.6.0 spec/api_client/base/inheritance_spec.rb
api_client-0.5.26-java spec/api_client/base/inheritance_spec.rb
api_client-0.5.26 spec/api_client/base/inheritance_spec.rb
api_client-0.5.25-java spec/api_client/base/inheritance_spec.rb
api_client-0.5.25 spec/api_client/base/inheritance_spec.rb
api_client-0.5.24 spec/api_client/base/inheritance_spec.rb
api_client-0.5.22 spec/api_client/base/inheritance_spec.rb
api_client-0.5.21 spec/api_client/base/inheritance_spec.rb
api_client-0.5.20 spec/api_client/base/inheritance_spec.rb
api_client-0.5.19 spec/api_client/base/inheritance_spec.rb
api_client-0.5.18 spec/api_client/base/inheritance_spec.rb
api_client-0.5.17 spec/api_client/base/inheritance_spec.rb
api_client-0.5.16 spec/api_client/base/inheritance_spec.rb
api_client-0.5.15 spec/api_client/base/inheritance_spec.rb
api_client-0.5.14 spec/api_client/base/inheritance_spec.rb
api_client-0.5.13 spec/api_client/base/inheritance_spec.rb
api_client-0.5.12 spec/api_client/base/inheritance_spec.rb
api_client-0.5.11 spec/api_client/base/inheritance_spec.rb
api_client-0.5.9 spec/api_client/base/inheritance_spec.rb