Sha256: c97618dfd16e0c29d96768a478c10732a6a54952baeb7bfb281804a12b475950

Contents?: true

Size: 962 Bytes

Versions: 1

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'

describe Zaim::Account do

  let(:request_url) { 'https://api.zaim.net/v2/home/account' }
  let(:response_headers) { { content_type: 'application/json' } }
  let(:response_body) { File.read('spec/fixtures/account.json') }
  let(:response) { { body: response_body, status: 200, headers: response_headers } }
  let(:client) { Zaim::Client.new }

  describe "#account" do

    before do
      stub_request( :get, request_url ).to_return( response )
    end

    subject { client.account }

    it { expect( subject ).to be_an_instance_of Hash }
    it { expect( subject ).to include('requested') }
    it { expect( subject ).to include('accounts') }

    context "response 'accounts'" do

      subject { client.account.fetch 'accounts' }

      it { expect( subject ).to be_an_instance_of Array }

      %w( id name color icon_url ).each do |key_name|
        it { expect( subject.first ).to include(key_name) }
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zaim-0.0.1 spec/zaim/account_spec.rb