Sha256: 8bec14b2e462914235e900da8e9889de3a2f9e76f5f7e31d37095e321357c54a

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Voog::API::Tags do

  let(:client) { voog_client }

  describe '#tags' do
    before do
      request_fixture(:get, 'tags', fixture: 'tags/tags')
    end

    it 'returns a list of tags' do
      expect(client.tags.length).to eql(2)
    end
  end

  describe '#tag' do
    before do
      request_fixture(:get, 'tags/2', fixture: 'tags/tag')
    end

    it 'returns a single tag' do
      expect(client.tag(2).name).to eq('art')
    end

    it 'returns a tag with the same id as in the request' do
      expect(client.tag(2).id).to eq(2)
    end
  end

  describe '#update_tag' do

    before do
      request_fixture(:put, 'tags/2', request: {body: {name: 'New Label'}}, response: {body: '{"id": 2, "name": "New Label"}'})
    end

    it 'responds with new name' do
      expect(client.update_tag(2, name: 'New Label').name).to eq('New Label')
    end
  end

  describe '#delete_tag' do

    before do
      request_fixture(:delete, 'tags/2')
    end

    it 'calls delete method on tag' do
      client.delete_tag(2)
      assert_requested :delete, 'http://voog.test/admin/api/tags/2'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voog_api-0.0.16 spec/voog_api/api/tags_spec.rb
voog_api-0.0.15 spec/voog_api/api/tags_spec.rb
voog_api-0.0.14 spec/voog_api/api/tags_spec.rb
voog_api-0.0.13 spec/voog_api/api/tags_spec.rb
voog_api-0.0.12 spec/voog_api/api/tags_spec.rb
voog_api-0.0.11 spec/voog_api/api/tags_spec.rb
voog_api-0.0.10 spec/voog_api/api/tags_spec.rb
voog_api-0.0.7 spec/voog_api/api/tags_spec.rb