Sha256: a0b05f949b6c3b60d748d752b492ace943acfee84afdfebd666d9bff3403373a

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe "Smartdc::Api::Machine::Metadata" do
  
  before(:all) do
    @object = Object.new
    @request = Smartdc::Request
  end

  describe ".create" do
    it "should return a metadata" do
      @object.stub(:content) {fixture('tag')}
      tag = @object.content
      @request.stub_chain(:new, :post).with('my/machines/id/metadata/', tag) {@object}

      metadata = Smartdc::Api::Machine::Metadata.new('id', {})
      metadata.create(tag).content.should == tag
    end
  end

  describe ".read" do
    it "should return some metadata" do
      @object.stub(:content) {fixture('tag')}
      @request.stub_chain(:new, :get).with('my/machines/id/metadata', {}) {@object}

      metadata = Smartdc::Api::Machine::Metadata.new('id', {})
      metadata.read.content.count.should > 0
    end
  end

  describe ".delete" do
    it "should return a metadata" do
      @object.stub(:status) {204}
      key = fixture('tag').first[0]
      @request.stub_chain(:new, :del).with('my/machines/id/metadata/' + key) {@object}

      metadata = Smartdc::Api::Machine::Metadata.new('id', {})
      metadata.destroy(key).status.should == 204
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smartdc-1.2.2 spec/unit/smartdc/api/machine/metadata_spec.rb
smartdc-1.2.1 spec/unit/smartdc/api/machine/metadata_spec.rb
smartdc-1.1.1 spec/unit/smartdc/api/machine/metadata_spec.rb
smartdc-1.0.1 spec/unit/smartdc/api/machine/metadata_spec.rb