spec/squall/network_spec.rb in squall-1.3.0 vs spec/squall/network_spec.rb in squall-1.3.1

- old
+ new

@@ -6,10 +6,11 @@ @keys = ["label", "created_at", "updated_at", "network_group_id", "vlan", "id", "identifier"] end describe "#list" do use_vcr_cassette "network/list" + it "returns a network list" do networks = @network.list networks.size.should be(2) end @@ -20,91 +21,79 @@ end end describe "#edit" do use_vcr_cassette 'network/edit' - it "requires an id" do - expect { @network.edit }.to raise_error(ArgumentError) - @network.success.should be_false - end - it "errors on invalid params" do - expect { @network.edit(1, :what => 1) }.to raise_error(ArgumentError, 'Unknown params: what') - end - it "accepts valid params" do - @network.edit(1, :label => 'one') + @network.edit(1, label: 'one') @network.success.should be_true - @network.edit(1, :network_group_id => 1) + @network.edit(1, network_group_id: 1) @network.success.should be_true - @network.edit(1, :identifier => 'lolzsdfds') + @network.edit(1, identifier: 'lolzsdfds') @network.success.should be_true - @network.edit(1, :vlan => 1) + @network.edit(1, vlan: 1) @network.success.should be_true - @network.edit(1, :label => 'two', :vlan => 2, :identifier => 'woah') + @network.edit(1, label: 'two', vlan: 2, identifier: 'woah') @network.success.should be_true end end describe "#create" do use_vcr_cassette "network/create" - it "requires label" do - requires_attr(:label) { @network.create } - end it "raises error on duplicate account" do pending "Broken in OnApp" do expect { - @network.create(:label => 'networktaken') + @network.create(label: 'networktaken') }.to raise_error(Squall::ServerError) @network.errors['label'].should include("has already been taken") end end - it "raises error on invalid params" do - expect { - @network.create(:what => 'networktaken', :label => 'wut') - }.to raise_error(ArgumentError, 'Unknown params: what') - end - it "creates a network" do - network = @network.create(:label => 'newnetwork', :vlan => 1, :identifier => 'newnetworkid') + network = @network.create(label: 'newnetwork', vlan: 1, identifier: 'newnetworkid') @network.success.should be_true network['label'].should == 'newnetwork' network['vlan'].should == 1 network['identifier'].should == 'newnetworkid' - network = @network.create(:label => 'newnetwork') + network = @network.create(label: 'newnetwork') network['label'].should == 'newnetwork' network['vlan'].should be_nil @network.success.should be_true - network = @network.create(:label => 'newnetwork', :vlan => 2) + network = @network.create(label: 'newnetwork', vlan: 2) network['label'].should == 'newnetwork' network['vlan'].should == 2 @network.success.should be_true - network = @network.create(:label => 'newnetwork', :identifier => 'something') + network = @network.create(label: 'newnetwork', identifier: 'something') network['label'].should == 'newnetwork' network['identifier'].should == 'something' @network.success.should be_true end end describe "#delete" do use_vcr_cassette 'network/delete' - it "requires an id" do - expect { @network.delete }.to raise_error(ArgumentError) - @network.success.should be_false - end it "deletes the network" do delete = @network.delete(16) + @network.success.should be_true + end + end + + describe "#rebuild" do + use_vcr_cassette 'network/rebuild' + + it "rebuilds the network for VM" do + rebuild = @network.rebuild(58) @network.success.should be_true end end end