Sha256: 13f46388f536c5889ec573e4f6c6c31acb4f5a7e66924c65709bcd65d8d39954

Contents?: true

Size: 1.47 KB

Versions: 18

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Profitbricks::Server do
  include Savon::Spec::Macros

  it "should create a new server with minimal arguments" do
    savon.expects(:create_server).returns(:minimal)
    savon.expects(:get_server).returns(:after_create)
    s = Server.create(:cores => 1, :ram => 256, :name => 'Test Server', :data_center_id => "b3eebede-5c78-417c-b1bc-ff5de01a0602")
    s.cores.should == 1
    s.ram.should == 256
    s.name.should == 'Test Server'
    s.data_center_id.should == "b3eebede-5c78-417c-b1bc-ff5de01a0602"
  end
  it "should reboot on request" do
    savon.expects(:get_server).returns(:after_create)
    savon.expects(:reboot_server).returns(:success)
    s = Server.find(:id => "b3eebede-5c78-417c-b1bc-ff5de01a0602")
    s.reboot.should == true
  end

  it "should be deleted" do
    savon.expects(:get_server).returns(:after_create)
    savon.expects(:delete_server).returns(:success)
    s = Server.find(:id => "b3eebede-5c78-417c-b1bc-ff5de01a0602")
    s.delete.should == true
  end

  describe "updating" do
    it "should update basic attributes correctly" do 
      savon.expects(:get_server).returns(:after_create)
      savon.expects(:update_server).returns(:basic)
      s = Server.find(:id => "b3eebede-5c78-417c-b1bc-ff5de01a0602")
      s.update(:cores => 2, :ram => 512, :name => "Power of two", :os_type => 'WINDOWS')
      s.cores.should == 2
      s.ram.should == 512
      s.name.should == "Power of two"
      s.os_type.should == 'WINDOWS'
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
profitbricks-0.9.8 spec/profitbricks/server_spec.rb
profitbricks-0.9.7 spec/profitbricks/server_spec.rb
profitbricks-0.9.6 spec/profitbricks/server_spec.rb
profitbricks-0.9.5 spec/profitbricks/server_spec.rb
profitbricks-0.9.4 spec/profitbricks/server_spec.rb
profitbricks-0.9.3 spec/profitbricks/server_spec.rb
profitbricks-0.9.2 spec/profitbricks/server_spec.rb
profitbricks-0.9.1 spec/profitbricks/server_spec.rb
profitbricks-0.9.0 spec/profitbricks/server_spec.rb
profitbricks-0.5.1 spec/profitbricks/server_spec.rb
profitbricks-0.5.0 spec/profitbricks/server_spec.rb
profitbricks-0.4.1 spec/profitbricks/server_spec.rb
profitbricks-0.4.0 spec/profitbricks/server_spec.rb
profitbricks-0.0.5 spec/profitbricks/server_spec.rb
profitbricks-0.0.4 spec/profitbricks/server_spec.rb
profitbricks-0.0.3 spec/profitbricks/server_spec.rb
profitbricks-0.0.2 spec/profitbricks/server_spec.rb
profitbricks-0.0.1 spec/profitbricks/server_spec.rb