Sha256: acbc2936097a5e5cc4f43ca20bd8debaca8fe68ca4543f062046ee709bc3c776

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe "CRUD for hosts" do

  before do
    @hg = Rubix::HostGroup.new(:name => 'rubix_spec_host_group_1')
    @hg.save
    
    @h1  = Rubix::Host.new(:name => 'rubix_spec_host_1', :host_groups => [@hg])
    @h1.save

    @h2  = Rubix::Host.new(:name => 'rubix_spec_host_2', :host_groups => [@hg])
    @h2.save
  end

  after do
    @h1.destroy
    @h2.destroy
    @hg.destroy
  end
  
  it "should be able to create, update, and destroy a host" do
    integration_test
    
    Rubix::Application.find(:name => 'rubix_spec_app_1', :host_id => @h1.id).should be_nil
    
    app = Rubix::Application.new(:name => 'rubix_spec_app_1', :host_id => @h1.id)
    app.save
    new_a = Rubix::Application.find(:name => 'rubix_spec_app_1', :host_id => @h1.id)
    new_a.should_not be_nil
    new_a.id.should == app.id
    new_a.host_id.should == @h1.id
    id = app.id
    id.should_not be_nil

    app.name = 'rubix_spec_app_2'
    app.update
    new_a = Rubix::Application.find(:id => id, :name => 'rubix_spec_app_2', :host_id => @h1.id)
    new_a.should_not be_nil
    new_a.name.should == 'rubix_spec_app_2'
    
    app.destroy
    Rubix::Application.find(:id => id, :host_id => @h1.id).should be_nil
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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