Sha256: c669ef8a6d8f3596c522ce7d088aff8f3e30403ae87796fa04187fa52d757c49

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'rubygems'
require 'require_relative' if RUBY_VERSION < '1.9'

require_relative File.join('..', 'common.rb')

describe Deltacloud::Collections::Drivers do

  before do
    def app; run_frontend; end
    @collection = Deltacloud::Collections.collection(:drivers)
  end

  it 'has index operation' do
    @collection.operation(:index).must_equal Sinatra::Rabbit::DriversCollection::IndexOperation
  end

  it 'has show operation' do
    @collection.operation(:show).must_equal Sinatra::Rabbit::DriversCollection::ShowOperation
  end

  it 'returns list of drivers in various formats with index operation' do
    formats.each do |format|
      header 'Accept', format
      get root_url + '/drivers'
      status.must_equal 200
    end
  end

  it 'returns details about driver in various formats with show operation' do
    formats.each do |format|
      header 'Accept', format
      get root_url + '/drivers/mock'
      status.must_equal 200
    end
  end

  it 'properly serialize attributes in JSON' do
    header 'Accept', 'application/json'
    get root_url + "/drivers/ec2"
    status.must_equal 200
    json['driver'].wont_be_empty
    json['driver']['id'].must_equal 'ec2'
    json['driver']['name'].must_equal 'EC2'
    json['driver']['entrypoints'].wont_be_empty
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deltacloud-core-1.1.1 tests/deltacloud/collections/drivers_collection_test.rb
deltacloud-core-1.1.0 tests/deltacloud/collections/drivers_collection_test.rb