Sha256: a2f7e196d42778cddec9bf29a96ae953f0383f23d0e27c9cb66a9dbe352ffebb

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Voog::API::Assets do

  let(:client) { voog_client }

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

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

  describe '#asset' do
    before do
      request_fixture(:get, 'assets/1', fixture: 'assets/asset')
    end

    it 'returns a single asset' do
      expect(client.asset(1).filename).to eq('Screen Shot 2014-01-28 at 10.53.26.png')
    end

    it 'returns an asset with the same id as in the request' do
      expect(client.asset(1).id).to eq(1)
    end
  end

  describe '#delete_asset' do

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

    it 'calls delete method on asset' do
      client.delete_asset(2)
      assert_requested :delete, 'http://voog.test/admin/api/assets/2'
    end
  end

  describe '#confirm_asset' do

    before do
      request_fixture(:put, 'assets/1/confirm', response: {body: '{"id": 1, "filename": "Screen Shot 2014-01-28 at 10.53.26.png"}'})
    end

    it 'responds with object' do
      expect(client.confirm_asset(1).filename).to eq('Screen Shot 2014-01-28 at 10.53.26.png')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voog_api-0.0.16 spec/voog_api/api/assets_spec.rb
voog_api-0.0.15 spec/voog_api/api/assets_spec.rb
voog_api-0.0.14 spec/voog_api/api/assets_spec.rb
voog_api-0.0.13 spec/voog_api/api/assets_spec.rb
voog_api-0.0.12 spec/voog_api/api/assets_spec.rb
voog_api-0.0.11 spec/voog_api/api/assets_spec.rb