Sha256: 2b065db23b5bc910acdd6d15c5ed2a2e224a1585f49a8574286b09fe40ce203f

Contents?: true

Size: 893 Bytes

Versions: 5

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'

describe Balanced::Resource do
  class ApiKey
    include Balanced::Resource::ClassMethods
  end

  before(:all) do
    @ak = ApiKey.new
  end

  describe 'construct_from_response' do
    it 'should return an instance of an ApiKey' do
      @payload = JSON.parse('{
                "links": {},
                "api_keys": [
                  {
                    "links": {},
                    "created_at": "2013-08-28T00:00:23.337278Z",
                    "secret": "d611bb800f7411e39f5d026ba7d79bff",
                    "href": "/api_keys/AK6vWygDNdcoQLHKdaHPtJ1B",
                    "meta": {},
                    "id": "AK6vWygDNdcoQLHKdaHPtJ1B"
                  }
                ]
              }')
      new_ak = @ak.construct_from_response @payload
      new_ak.should_not be_nil
      new_ak.should be_instance_of(Balanced::ApiKey)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
balanced-1.1.0 spec/balanced/resources/resource_spec.rb
balanced-1.0.2 spec/balanced/resources/resource_spec.rb
balanced-1.0.1 spec/balanced/resources/resource_spec.rb
balanced-1.0 spec/balanced/resources/resource_spec.rb
balanced-1.0.beta1 spec/balanced/resources/resource_spec.rb