Sha256: 5685c78533b04ee5ec0416fe33aef870396f72717b427fe35fc3d9e442ce6f38

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe Squall::Template do
  before(:each) do
    default_config
    @template = Squall::Template.new
    @keys = ["label", "operating_system_distro", "operating_system_arch", "created_at", 
      "operating_system_tail", "operating_system", "updated_at", "operating_system_edition", 
      "allowed_swap", "allow_resize_without_reboot", "virtualization", "id", "file_name", 
      "checksum", "version", "user_id", "template_size", "allowed_hot_migrate", "min_disk_size", "state"]
  end

  describe "#list" do
    use_vcr_cassette 'template/list'

    it "returns a list" do
      list = @template.list
      list.size.should be(22)

      first = list.first
      first.keys.should include(*@keys)
      first['label'].should == 'CentOS 5.5 x64'
    end
  end

  describe "#make_public" do
    use_vcr_cassette 'template/make_public'
    it "requires an id" do
      expect { @template.make_public }.to raise_error(ArgumentError)
      @template.success.should be_false
    end

    it "404s on not found" do
      expect { @template.make_public(404) }.to raise_error(Squall::NotFound)
      @template.success.should be_false
    end

    it "makes the template public" do
      pub = @template.make_public(1)
      @template.success.should be_true
      pub.keys.should include(*@keys)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
squall-1.0.2 spec/squall/template_spec.rb
squall-1.0.1 spec/squall/template_spec.rb