Sha256: 9910ee2286cde44d8f4b57496a85b09e257d8cfeafa916e0be2ddaeff7e2a9db

Contents?: true

Size: 883 Bytes

Versions: 17

Compression:

Stored size: 883 Bytes

Contents

require "spec_helper"

describe ApiClient::Base do

  it "is a subclass of Hashie::Mash" do
    ApiClient::Base.should inherit_from(Hashie::Mash)
  end

  it "responds to #id" do
    subject.should respond_to("id")
  end


  describe "#inspect" do

    it "has a nice inspect" do
      subject.update(:id => 1).inspect.should == '#<ApiClient::Base id: 1>'
    end

    it "presents all fields in inspect" do
      subject.update(:id => 1, :foo => 'OMG')
      subject.inspect.should == '#<ApiClient::Base id: 1, foo: "OMG">'
    end

    it "inspects subobjects properly" do
      subject.update(:id => 1, :sub => [1,2])
      subject.inspect.should == '#<ApiClient::Base id: 1, sub: [1, 2]>'
    end

    it "makes sure id is the first key" do

      subject.update(:foo => 'OMG', :id => 1)
      subject.inspect.should == '#<ApiClient::Base id: 1, foo: "OMG">'
    end

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
api_client-0.5.5 spec/api_client/base_spec.rb
api_client-0.5.4 spec/api_client/base_spec.rb
api_client-0.5.3 spec/api_client/base_spec.rb
api_client-0.5.2 spec/api_client/base_spec.rb
api_client-0.5.1 spec/api_client/base_spec.rb
api_client-0.5.0 spec/api_client/base_spec.rb
api_client-0.4.3 spec/api_client/base_spec.rb
api_client-0.4.2 spec/api_client/base_spec.rb
api_client-0.4.1 spec/api_client/base_spec.rb
api_client-0.3.3 spec/api_client/base_spec.rb
api_client-0.4.0 spec/api_client/base_spec.rb
api_client-0.3.2 spec/api_client/base_spec.rb
api_client-0.3.1 spec/api_client/base_spec.rb
api_client-0.3.0 spec/api_client/base_spec.rb
api_client-0.2.0 spec/api_client/base_spec.rb
api_client-0.1.9 spec/api_client/base_spec.rb
api_client-0.1.8 spec/api_client/base_spec.rb