Sha256: a130ac0f0442071eebdfe73c1a00018f39e848d744344b0427219ccf40209476

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Voog::API::LayoutAssets do
  
  let(:client) { voog_client }
  
  describe '#layout_assets' do
    before do
      request_fixture(:get, 'layout_assets', fixture: 'layout_assets/layout_assets')
    end
  
    it 'returns a list of layout_assets' do
      expect(client.layout_assets.length).to eq(2)
    end
  end
  
  describe '#layout_asset' do
    before do
      request_fixture(:get, 'layout_assets/2', fixture: 'layout_assets/layout_asset')
    end
  
    it 'returns a single layout_asset' do
      expect(client.layout_asset(2).filename).to eq('style.css')
    end
  
    it 'returns a layout_asset with the same id as in the request' do
      expect(client.layout_asset(2).id).to eql(2)
    end
  
  end
  
  describe '#delete_layout_asset' do
    
    before do
      request_fixture(:delete, 'layout_assets/2')
    end
    
    it 'calls delete method on layout asset' do
      client.delete_layout_asset(2)
      assert_requested :delete, voog_url('layout_assets/2')
    end
  end
  
  describe '#update_layout_asset' do
    
    before do
      request_fixture(:put, 'layout_assets/2', request: {body: {filename: 'new_asset.css'}}, response: {body: '{"id": 2, "filename": "new_asset.css"}'})
    end
    
    it 'changes filename' do
      expect(client.update_layout_asset(2, filename: 'new_asset.css').filename).to eq('new_asset.css')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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