Sha256: 3a08b7969106ff94f7267a63fbfcebecce5991e891e2368242422e011407edbc

Contents?: true

Size: 1.38 KB

Versions: 15

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe "Templates" do

  before do
    integration_test
    @host_group_1 = ensure_save(Rubix::HostGroup.new(:name => 'rubix_spec_host_group_1'))
    @host_group_2 = ensure_save(Rubix::HostGroup.new(:name => 'rubix_spec_host_group_2'))
  end

  after do
    truncate_all_tables
  end

  describe "when not existing" do

    it "returns nil on find" do
      Rubix::Template.find(:name => 'rubix_spec_template_1').should be_nil
    end

    it "can be created" do
      template = Rubix::Template.new(:name => 'rubix_spec_template_1', :host_groups => [@host_group_1])
      template.save.should be_true
    end

    it "can be imported" do
      Rubix::Template.import(File.new(data_path('test_template.xml')))
      Rubix::Template.find(:name => 'test').should_not be_nil
    end
    
  end

  describe "when existing" do

    before do
      @template = ensure_save(Rubix::Template.new(:name => 'rubix_spec_template_1', :host_groups => [@host_group_1]))
    end

    it "can have its name changed" do
      @template.name = 'rubix_spec_template_2'
      @template.save
      Rubix::Template.find(:name => 'rubix_spec_template_1').should     be_nil
      Rubix::Template.find(:name => 'rubix_spec_template_2').should_not be_nil
    end

    it "can be destroyed" do
      @template.destroy
      Rubix::Template.find(:name => 'rubix_spec_template_1').should be_nil
    end
    
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubix-0.5.14 spec/requests/template_request_spec.rb
rubix-0.5.13 spec/requests/template_request_spec.rb
rubix-0.5.9 spec/requests/template_request_spec.rb
rubix-0.5.8 spec/requests/template_request_spec.rb
rubix-0.5.7 spec/requests/template_request_spec.rb
rubix-0.5.6 spec/requests/template_request_spec.rb
rubix-0.5.5 spec/requests/template_request_spec.rb
rubix-0.5.4 spec/requests/template_request_spec.rb
rubix-0.5.3 spec/requests/template_request_spec.rb
rubix-0.5.2 spec/requests/template_request_spec.rb
rubix-0.5.1 spec/requests/template_request_spec.rb
rubix-0.5.0 spec/requests/template_request_spec.rb
rubix-0.4.3 spec/requests/template_request_spec.rb
rubix-0.4.2 spec/requests/template_request_spec.rb
rubix-0.4.1 spec/requests/template_request_spec.rb