Sha256: c8b857534a2bbd479e532ae46b5640fe6e697817a00f4e24a1942693128a24f0

Contents?: true

Size: 1.14 KB

Versions: 42

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Acfs::Service do
  let(:srv_class) { Class.new(Acfs::Service) { identity :test } }
  let(:options) { {} }
  let(:service) { srv_class.new options }

  before do
    Acfs::Configuration.current.locate :test, ''
  end

  describe '#initialize' do
    let(:options) { { path: 'abc', key: 'value' } }

    it 'should set options' do
      expect(service.options).to eq(options)
    end
  end

  describe '#location' do
    let(:resource) { Class.new }
    before { allow(resource).to receive(:location_default_path, &proc{|a, p| p}) }

    it 'should extract resource path name from given class' do
      expect(service.location(resource).to_s).to eq('/classes')
    end

    context 'with path options' do
      let(:options) { { path: 'abc' } }

      it 'should have custom resource path' do
        expect(service.location(resource).to_s).to eq('/abc')
      end
    end
  end

  describe '.base_url' do

    before do
      Acfs::Configuration.current.locate :test, 'http://abc.de/api/v1'
    end

    it 'should return configured URI for service' do

      expect(srv_class.base_url).to eq('http://abc.de/api/v1')
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
acfs-0.34.0.1.b288 spec/acfs/service_spec.rb
acfs-0.34.0.1.b287 spec/acfs/service_spec.rb
acfs-0.34.0.1.b286 spec/acfs/service_spec.rb
acfs-0.34.0 spec/acfs/service_spec.rb
acfs-0.33.1.1.b285 spec/acfs/service_spec.rb
acfs-0.33.1.1.b281 spec/acfs/service_spec.rb
acfs-0.33.1 spec/acfs/service_spec.rb
acfs-0.33.0.1.b278 spec/acfs/service_spec.rb
acfs-0.33.0 spec/acfs/service_spec.rb
acfs-0.32.1.1.b277 spec/acfs/service_spec.rb
acfs-0.32.1.1.b276 spec/acfs/service_spec.rb
acfs-0.32.1.1.b275 spec/acfs/service_spec.rb
acfs-0.32.1.1.b274 spec/acfs/service_spec.rb
acfs-0.32.1.1.b272 spec/acfs/service_spec.rb
acfs-0.32.1 spec/acfs/service_spec.rb
acfs-0.32.0.1.b270 spec/acfs/service_spec.rb
acfs-0.31.0.1.b269 spec/acfs/service_spec.rb
acfs-0.32.0 spec/acfs/service_spec.rb
acfs-0.31.0.1.b265 spec/acfs/service_spec.rb
acfs-0.31.0.1.b263 spec/acfs/service_spec.rb