Sha256: a0928422357cfbfb85457ea4f8089d27e51cb8b16c904d00c4109592d4fb6c0d

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe "CRUD for templates" do

  before do
    @hg1 = Rubix::HostGroup.new(:name => 'rubix_spec_host_group_1')
    @hg1.save

    @hg2 = Rubix::HostGroup.new(:name => 'rubix_spec_host_group_2')
    @hg2.save
    
  end

  after do
    @hg1.destroy
    @hg2.destroy
  end

  it "should be able to create, update, and destroy a template" do
    integration_test
    
    Rubix::Template.find(:name => 'rubix_spec_template_1').should be_nil
    
    t = Rubix::Template.new(:name => 'rubix_spec_template_1', :host_groups => [@hg1])
    t.save
    
    new_t = Rubix::Template.find(:name => 'rubix_spec_template_1')
    new_t.should_not be_nil
    new_t.id.should == t.id
    new_t.host_group_ids.should include(@hg1.id)
    id = t.id
    id.should_not be_nil

    t.name = 'rubix_spec_template_2'
    t.host_groups = [@hg2]
    t.update

    new_t = Rubix::Template.find(:id => id)
    new_t.name.should == 'rubix_spec_template_2'
    new_t.host_group_ids.should_not include(@hg1.id)
    new_t.host_group_ids.should     include(@hg2.id)
    
    t.destroy
    Rubix::Template.find(:id => id).should be_nil
  end

  it "should be able to import and export a template" do
    integration_test
    pending "Learning how to import/export XML via the API"
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubix-0.0.7 spec/requests/template_request_spec.rb
rubix-0.0.6 spec/requests/template_request_spec.rb
rubix-0.0.5 spec/requests/template_request_spec.rb
rubix-0.0.4 spec/requests/template_request_spec.rb
rubix-0.0.3 spec/requests/template_request_spec.rb
rubix-0.0.2 spec/requests/template_request_spec.rb