Sha256: 54ae47674cc94e25ba59d5e20c879bb1e476dac677e675676997fec4207100ae

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

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

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

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

  describe 'full_user' do
    let(:body) { fixture('responses/full_user_success') }
    let(:request_path) { '/bluestatedigital/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.bluestatedigital.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.bluestatedigital.full_user('1').should == nil
      end
    end
  end

  describe 'tokyo_blue_state_digital_user_path' do
    it "should return rooted relative path to tokyo user API endpoint" do
      subject.bluestatedigital.tokyo_blue_state_digital_user_path('-123456').should == '/bluestatedigital/constituent/-123456'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_api-0.2.0 spec/bluestatedigital_spec.rb