Sha256: 9eea72e610ea60b588fdc02ad9067beb42af95b6dcf9d55e8ec6f416dcdd6f70

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Squall::Template do
  before(:each) do
    @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::NotFoundError)
      @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.2.1beta1 spec/squall/template_spec.rb
squall-1.2.0beta1 spec/squall/template_spec.rb