Sha256: 13180188089da22840714fc0e358d0fb779ea6aa3467da66532ef1b58917f6d7

Contents?: true

Size: 763 Bytes

Versions: 3

Compression:

Stored size: 763 Bytes

Contents

require_relative '../test_helper'
require 'hyperclient/resource_factory'

module Hyperclient
  describe ResourceFactory do
    let(:resource) do
      ResourceFactory.resource('/path/to/resource')
    end

    before do
      Hyperclient::Resource.entry_point = 'http://myapi.org'
    end

    describe 'resource' do
      it 'creates a new resource when is not present in the identity map' do
        resource = ResourceFactory.resource('/path/to/resource')

        resource.url.must_include '/path/to/resource'
      end

      it 'returns the resource when is already present in the identity map' do
        new_resource = ResourceFactory.resource('/path/to/resource')

        new_resource.object_id.must_equal resource.object_id
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyperclient-0.0.5 test/hyperclient/resource_factory_test.rb
hyperclient-0.0.4 test/hyperclient/resource_factory_test.rb
hyperclient-0.0.3 test/hyperclient/resource_factory_test.rb