Sha256: 54b54eabe281455c42c90d5ea6e57bce4db43bfca5e5a6035bd9271a54710215
Contents?: true
Size: 1.27 KB
Versions: 15
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Emojidex::API::Categories do subject { Emojidex::Client.new(host: 'http://localhost') } let!(:api_url) { 'http://localhost/api/v1' } describe '#categories' do before do stub_get("#{api_url}/categories.json") .to_return( body: fixture('categories.json'), headers: { content_type: 'application/json' } ) end it 'requests the correct resource' do subject.categories expect(a_get("#{api_url}/categories.json")).to have_been_made end it 'returns the requested categories' do categories = subject.categories expect(categories).to be_an Array expect(categories.first).to be_a Hash end end describe '#category' do before do stub_get("#{api_url}/categories/category.json") .to_return( body: fixture('category.json'), headers: { content_type: 'application/json' } ) end it 'requests the correct resource' do subject.category expect(a_get("#{api_url}/categories/category.json")).to have_been_made end it 'returns the requested category' do category = subject.category expect(category).to be_a Hash end end end
Version data entries
15 entries across 15 versions & 1 rubygems