Sha256: 15eeab3f1730bc8b7760875a2a19b5aafba976f9aedd0f02c809f29d710bd071

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

#encoding: utf-8

require 'spec_helper'

describe HH::API::Region do
  let(:client) { HH::Client.new }

  describe "#regions" do
    before do
      stub_get("region/all").to_return(body: fixture("regions_all.json"), headers: {content_type: "application/json; charset=utf-8"})
    end

    it "requests the correct resource" do
      client.regions
      expect(a_get("region/all")).to have_been_made
    end

    it "returns the requested regions all" do
      regions = client.regions
      expect(regions).to be_an Array
      expect(regions.first).to be_an Hash
      expect(regions.first[:name]).to eq "Москва"
    end
  end

  describe "#region" do
    before do
      stub_get("region/1").to_return(body: fixture("region.json"), headers: {content_type: "application/json; charset=utf-8"})
    end

    it "requests the correct resource" do
      client.region(1)
      expect(a_get("region/1")).to have_been_made
    end

    it "returns the requested regions all" do
      region = client.region(1)
      expect(region).to be_an Hash
      expect(region[:name]).to eq "Москва"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hh-0.0.6 spec/hh/api/region_spec.rb
hh-0.0.5 spec/hh/api/region_spec.rb
hh-0.0.4 spec/hh/api/region_spec.rb