Sha256: 4e19c5613f0dc02f2e79762f9c5ed4ada32a4e70fa5e443d4285047cd765b760

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require 'spec_helper'

describe Zaim::Genre do

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

  describe "#genre" do

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

    subject { client.genre }

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

    context "response 'genres'" do

      subject { client.genre.fetch 'genres' }

      it { expect( subject ).to be_an_instance_of Array }

      %w( id name mode sort parent_genre_id ).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/genre_spec.rb