Sha256: ae17c37baaab412c6704bd363c5a006c5316f5bb634b43ab02f6ff9f46115b66

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe TokyoApi::Actionkit do
  subject { TokyoApi.new(host: 'test.com') }

  describe 'configuration' do
    it 'should propagate the host' do
      subject.actionkit.client.connection.configuration.host.should == 'test.com'
    end
  end

  describe 'full_user' do
    let(:body) { fixture('responses/full_user_success') }
    let(:request_path) { '/actionkit/full_user/1' }
    let(:status) { 200 }

    before(:each) do
     stub_get(request_path).to_return(:body => body, :status => status,
                                     :headers => { content_type: "application/json; charset=utf-8"})
    end

    describe 'error' do
      let(:body) { fixture('responses/full_user_error') }

      it 'should find an organisation' do
        subject.actionkit.full_user('1').should == {'error' => 'Connection refused'}
      end
    end

    describe 'error' do
      let(:body) { fixture('responses/full_user_success') } #TODO: actually figure out what this returns.

      it 'should find an organisation' do
        subject.actionkit.full_user('1').should == nil
      end
    end

    describe 'user_path' do
      it "should return relative path to user API endpoint" do
        subject.actionkit.user_path('abc.123.xyz').should == '/actionkit/user/abc.123.xyz'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_api-0.2.0 spec/actionkit_spec.rb