spec/requests/host_request_spec.rb in rubix-0.3.1 vs spec/requests/host_request_spec.rb in rubix-0.4.0
- old
+ new
@@ -3,11 +3,10 @@
describe "Hosts" do
before do
integration_test
@host_group_1 = ensure_save(Rubix::HostGroup.new(:name => 'rubix_spec_host_group_1'))
-
end
after do
truncate_all_tables
end
@@ -16,10 +15,18 @@
it "returns nil on find" do
Rubix::Host.find(:name => 'rubix_spec_host_1').should be_nil
end
+ it "returns an empty array when listing without IDs" do
+ Rubix::Host.list([1,2,3]).should == []
+ end
+
+ it "returns an empty array when listing with IDs" do
+ Rubix::Host.list([1,2,3]).should == []
+ end
+
it "can be created" do
host = Rubix::Host.new(:name => 'rubix_spec_host_1', :host_groups => [@host_group_1])
host.save.should be_true
host.monitored.should be_true
host.use_ip.should be_true
@@ -32,10 +39,17 @@
@host = ensure_save(Rubix::Host.new(:name => 'rubix_spec_host_1', :host_groups => [@host_group_1]))
@template_1 = ensure_save(Rubix::Template.new(:name => 'rubix_spec_template_1', :host_groups => [@host_group_2]))
@template_2 = ensure_save(Rubix::Template.new(:name => 'rubix_spec_template_2', :host_groups => [@host_group_2]))
end
+ it "can be listed by ID" do
+ hosts = Rubix::Host.list([@host.id])
+ hosts.should_not be_nil
+ hosts.should_not be_empty
+ hosts.first.name.should == @host.name
+ end
+
it "can have its name changed" do
@host.name = 'rubix_spec_host_2'
@host.save
Rubix::Host.find(:name => 'rubix_spec_host_1').should be_nil
@@ -76,6 +90,7 @@
@host.destroy
Rubix::Host.find(:name => 'rubix_spec_host_1').should be_nil
end
end
+
end