Sha256: a2e8e0d167ec2e420e064e119ecc935a6346b78c265e2154ef99566493f53aee

Contents?: true

Size: 908 Bytes

Versions: 14

Compression:

Stored size: 908 Bytes

Contents

require 'spec_helper'

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

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

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

  describe '#url_for' do
    it 'should extract resource path name from given class' do
      expect(service.url_for(Class)).to eq('/classes')
    end

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

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

  describe '.base_url' do
    it "should have a static base_url configuration option" do
      srv_class.base_url = 'http://abc.de/api/v1'

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
acfs-0.15.0 spec/acfs/service_spec.rb
acfs-0.14.0 spec/acfs/service_spec.rb
acfs-0.13.0 spec/acfs/service_spec.rb
acfs-0.12.0 spec/acfs/service_spec.rb
acfs-0.11.0 spec/acfs/service_spec.rb
acfs-0.10.0 spec/acfs/service_spec.rb
acfs-0.9.0 spec/acfs/service_spec.rb
acfs-0.8.0 spec/acfs/service_spec.rb
acfs-0.7.0 spec/acfs/service_spec.rb
acfs-0.6.0 spec/service_spec.rb
acfs-0.5.1 spec/service_spec.rb
acfs-0.5.0 spec/service_spec.rb
acfs-0.4.0 spec/service_spec.rb
acfs-0.3.0 spec/service_spec.rb