Sha256: cfed081eb5690cb61462ef022a171ab5758279fdfe5baeab0701613bb2632535

Contents?: true

Size: 749 Bytes

Versions: 16

Compression:

Stored size: 749 Bytes

Contents

require "spec_helper"

describe "Marshaling of ApiClient objects" do
  ConnectionProc = Proc.new {}
  AlwaysProc = Proc.new {}

  class Entity < ApiClient::Base
    connection &ConnectionProc
    always &AlwaysProc

    def mutated_state?
      @state == "mutated"
    end

    def mutate_state!
      @state = "mutated"
    end
  end

  it "is marshallable by default" do
    scope = Entity.params(:foo => 1).headers("token" => "aaa").options("some" => "option")
    entity = scope.build :key => "value"

    entity.mutated_state?.should == false
    entity.mutate_state!
    entity.mutated_state?.should == true

    reloaded = Marshal.load(Marshal.dump(entity))

    reloaded.should == entity
    reloaded.mutated_state?.should == true
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
api_client-0.6.0-java spec/api_client/base/marshalling_spec.rb
api_client-0.6.0 spec/api_client/base/marshalling_spec.rb
api_client-0.5.26-java spec/api_client/base/marshalling_spec.rb
api_client-0.5.26 spec/api_client/base/marshalling_spec.rb
api_client-0.5.25-java spec/api_client/base/marshalling_spec.rb
api_client-0.5.25 spec/api_client/base/marshalling_spec.rb
api_client-0.5.24 spec/api_client/base/marshalling_spec.rb
api_client-0.5.22 spec/api_client/base/marshalling_spec.rb
api_client-0.5.21 spec/api_client/base/marshalling_spec.rb
api_client-0.5.20 spec/api_client/base/marshalling_spec.rb
api_client-0.5.19 spec/api_client/base/marshalling_spec.rb
api_client-0.5.18 spec/api_client/base/marshalling_spec.rb
api_client-0.5.17 spec/api_client/base/marshalling_spec.rb
api_client-0.5.16 spec/api_client/base/marshalling_spec.rb
api_client-0.5.15 spec/api_client/base/marshalling_spec.rb
api_client-0.5.14 spec/api_client/base/marshalling_spec.rb