squall 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README.md +64 -41
  4. data/Rakefile +3 -9
  5. data/lib/squall/data_store_zone.rb +20 -26
  6. data/lib/squall/disk.rb +174 -0
  7. data/lib/squall/firewall_rule.rb +34 -41
  8. data/lib/squall/hypervisor.rb +40 -38
  9. data/lib/squall/hypervisor_zone.rb +51 -63
  10. data/lib/squall/ip_address.rb +32 -37
  11. data/lib/squall/ip_address_join.rb +13 -22
  12. data/lib/squall/network.rb +36 -33
  13. data/lib/squall/network_zone.rb +27 -29
  14. data/lib/squall/payment.rb +22 -32
  15. data/lib/squall/role.rb +30 -37
  16. data/lib/squall/statistic.rb +3 -1
  17. data/lib/squall/support/base.rb +35 -31
  18. data/lib/squall/support/config.rb +25 -1
  19. data/lib/squall/support/version.rb +1 -1
  20. data/lib/squall/template.rb +7 -5
  21. data/lib/squall/transaction.rb +6 -4
  22. data/lib/squall/user.rb +84 -83
  23. data/lib/squall/user_group.rb +17 -30
  24. data/lib/squall/virtual_machine.rb +154 -178
  25. data/lib/squall/whitelist.rb +29 -40
  26. data/lib/squall.rb +27 -25
  27. data/spec/spec_helper.rb +6 -11
  28. data/spec/squall/data_store_zone_spec.rb +2 -20
  29. data/spec/squall/disk_spec.rb +189 -0
  30. data/spec/squall/firewall_rule_spec.rb +2 -32
  31. data/spec/squall/hypervisor_spec.rb +3 -47
  32. data/spec/squall/hypervisor_zone_spec.rb +3 -28
  33. data/spec/squall/ip_address_join_spec.rb +1 -15
  34. data/spec/squall/ip_address_spec.rb +10 -35
  35. data/spec/squall/network_spec.rb +20 -31
  36. data/spec/squall/network_zone_spec.rb +2 -36
  37. data/spec/squall/payment_spec.rb +2 -21
  38. data/spec/squall/role_spec.rb +4 -16
  39. data/spec/squall/support/base_spec.rb +10 -16
  40. data/spec/squall/template_spec.rb +0 -4
  41. data/spec/squall/transaction_spec.rb +1 -3
  42. data/spec/squall/user_group_spec.rb +1 -17
  43. data/spec/squall/user_spec.rb +4 -92
  44. data/spec/squall/virtual_machine_spec.rb +8 -242
  45. data/spec/squall/whitelist_spec.rb +2 -40
  46. data/spec/squall_spec.rb +2 -2
  47. data/spec/vcr_cassettes/disk/add_schedule.yml +40 -0
  48. data/spec/vcr_cassettes/disk/auto_backup_off.yml +40 -0
  49. data/spec/vcr_cassettes/disk/auto_backup_on.yml +40 -0
  50. data/spec/vcr_cassettes/disk/backups.yml +40 -0
  51. data/spec/vcr_cassettes/disk/build.yml +40 -0
  52. data/spec/vcr_cassettes/disk/create.yml +40 -0
  53. data/spec/vcr_cassettes/disk/delete.yml +38 -0
  54. data/spec/vcr_cassettes/disk/edit.yml +40 -0
  55. data/spec/vcr_cassettes/disk/iops_usage.yml +40 -0
  56. data/spec/vcr_cassettes/disk/list.yml +40 -0
  57. data/spec/vcr_cassettes/disk/migrate.yml +38 -0
  58. data/spec/vcr_cassettes/disk/schedules.yml +40 -0
  59. data/spec/vcr_cassettes/disk/unlock.yml +40 -0
  60. data/spec/vcr_cassettes/disk/vm_disk_list.yml +40 -0
  61. data/spec/vcr_cassettes/network/rebuild.yml +41 -0
  62. metadata +217 -66
  63. data/.gitignore +0 -13
  64. data/.rspec +0 -2
  65. data/.rvmrc +0 -41
  66. data/.travis.yml +0 -17
  67. data/lib/squall/support/params.rb +0 -50
  68. data/lib/squall/support/yaml.rb +0 -5
  69. data/spec/squall/support/params_spec.rb +0 -195
  70. data/squall.gemspec +0 -32
@@ -10,10 +10,6 @@ describe Squall::IpAddress do
10
10
  describe "#list" do
11
11
  use_vcr_cassette 'ipaddress/list'
12
12
 
13
- it "requires network_id" do
14
- expect { @ip.list }.to raise_error(ArgumentError)
15
- end
16
-
17
13
  it "returns ip_addresses" do
18
14
  ips = @ip.list(1)
19
15
  ips.should be_an(Array)
@@ -29,21 +25,13 @@ describe Squall::IpAddress do
29
25
  use_vcr_cassette 'ipaddress/edit'
30
26
 
31
27
  ip_params = {
32
- :address => '109.123.91.67',
33
- :netmask => '255.255.255.193',
34
- :broadcast => '109.123.91.128',
35
- :network_address => '109.123.91.65',
36
- :gateway => '109.123.91.66'
28
+ address: '109.123.91.67',
29
+ netmask: '255.255.255.193',
30
+ broadcast: '109.123.91.128',
31
+ network_address: '109.123.91.65',
32
+ gateway: '109.123.91.66'
37
33
  }
38
34
 
39
- it "raises ArgumentError without required arguments" do
40
- expect { @ip.edit }.to raise_error(ArgumentError)
41
- end
42
-
43
- it "raises ArgumentError without id argument" do
44
- expect { @ip.edit(1) }.to raise_error(ArgumentError)
45
- end
46
-
47
35
  it "edits the IpAddress" do
48
36
  ip = @ip.edit(1, 1, ip_params)
49
37
  @ip.success.should be_true
@@ -53,21 +41,13 @@ describe Squall::IpAddress do
53
41
  describe "#create" do
54
42
  use_vcr_cassette 'ipaddress/create'
55
43
 
56
- it "raises ArgumentError without network_id" do
57
- expect { @ip.create }.to raise_error(ArgumentError)
58
- end
59
-
60
- it "raises ArgumentError without required options" do
61
- expect { @ip.create(1, {}) }.to raise_error(ArgumentError)
62
- end
63
-
64
44
  it "creates a new IP" do
65
45
  new_ip = @ip.create(1,
66
- :address => '109.123.91.24',
67
- :netmask => '255.255.255.194',
68
- :broadcast => '109.123.91.129',
69
- :network_address => '109.123.91.66',
70
- :gateway => '109.123.91.67'
46
+ address: '109.123.91.24',
47
+ netmask: '255.255.255.194',
48
+ broadcast: '109.123.91.129',
49
+ network_address: '109.123.91.66',
50
+ gateway: '109.123.91.67'
71
51
  )
72
52
 
73
53
  @ip.success.should be_true
@@ -77,11 +57,6 @@ describe Squall::IpAddress do
77
57
  describe "#delete" do
78
58
  use_vcr_cassette 'ipaddress/delete'
79
59
 
80
- it "raises ArgumentError without network_id or id" do
81
- expect { @ip.delete }.to raise_error(ArgumentError)
82
- expect { @ip.delete(1) }.to raise_error(ArgumentError)
83
- end
84
-
85
60
  it "deletes the IP" do
86
61
  @ip.delete(1, 1)
87
62
  @ip.success.should be_true
@@ -8,6 +8,7 @@ describe Squall::Network do
8
8
 
9
9
  describe "#list" do
10
10
  use_vcr_cassette "network/list"
11
+
11
12
  it "returns a network list" do
12
13
  networks = @network.list
13
14
  networks.size.should be(2)
@@ -22,73 +23,56 @@ describe Squall::Network do
22
23
 
23
24
  describe "#edit" do
24
25
  use_vcr_cassette 'network/edit'
25
- it "requires an id" do
26
- expect { @network.edit }.to raise_error(ArgumentError)
27
- @network.success.should be_false
28
- end
29
-
30
- it "errors on invalid params" do
31
- expect { @network.edit(1, :what => 1) }.to raise_error(ArgumentError, 'Unknown params: what')
32
- end
33
26
 
34
27
  it "accepts valid params" do
35
- @network.edit(1, :label => 'one')
28
+ @network.edit(1, label: 'one')
36
29
  @network.success.should be_true
37
30
 
38
- @network.edit(1, :network_group_id => 1)
31
+ @network.edit(1, network_group_id: 1)
39
32
  @network.success.should be_true
40
33
 
41
- @network.edit(1, :identifier => 'lolzsdfds')
34
+ @network.edit(1, identifier: 'lolzsdfds')
42
35
  @network.success.should be_true
43
36
 
44
- @network.edit(1, :vlan => 1)
37
+ @network.edit(1, vlan: 1)
45
38
  @network.success.should be_true
46
39
 
47
- @network.edit(1, :label => 'two', :vlan => 2, :identifier => 'woah')
40
+ @network.edit(1, label: 'two', vlan: 2, identifier: 'woah')
48
41
  @network.success.should be_true
49
42
  end
50
43
  end
51
44
 
52
45
  describe "#create" do
53
46
  use_vcr_cassette "network/create"
54
- it "requires label" do
55
- requires_attr(:label) { @network.create }
56
- end
57
47
 
58
48
  it "raises error on duplicate account" do
59
49
  pending "Broken in OnApp" do
60
50
  expect {
61
- @network.create(:label => 'networktaken')
51
+ @network.create(label: 'networktaken')
62
52
  }.to raise_error(Squall::ServerError)
63
53
  @network.errors['label'].should include("has already been taken")
64
54
  end
65
55
  end
66
56
 
67
- it "raises error on invalid params" do
68
- expect {
69
- @network.create(:what => 'networktaken', :label => 'wut')
70
- }.to raise_error(ArgumentError, 'Unknown params: what')
71
- end
72
-
73
57
  it "creates a network" do
74
- network = @network.create(:label => 'newnetwork', :vlan => 1, :identifier => 'newnetworkid')
58
+ network = @network.create(label: 'newnetwork', vlan: 1, identifier: 'newnetworkid')
75
59
  @network.success.should be_true
76
60
 
77
61
  network['label'].should == 'newnetwork'
78
62
  network['vlan'].should == 1
79
63
  network['identifier'].should == 'newnetworkid'
80
64
 
81
- network = @network.create(:label => 'newnetwork')
65
+ network = @network.create(label: 'newnetwork')
82
66
  network['label'].should == 'newnetwork'
83
67
  network['vlan'].should be_nil
84
68
  @network.success.should be_true
85
69
 
86
- network = @network.create(:label => 'newnetwork', :vlan => 2)
70
+ network = @network.create(label: 'newnetwork', vlan: 2)
87
71
  network['label'].should == 'newnetwork'
88
72
  network['vlan'].should == 2
89
73
  @network.success.should be_true
90
74
 
91
- network = @network.create(:label => 'newnetwork', :identifier => 'something')
75
+ network = @network.create(label: 'newnetwork', identifier: 'something')
92
76
  network['label'].should == 'newnetwork'
93
77
  network['identifier'].should == 'something'
94
78
  @network.success.should be_true
@@ -97,14 +81,19 @@ describe Squall::Network do
97
81
 
98
82
  describe "#delete" do
99
83
  use_vcr_cassette 'network/delete'
100
- it "requires an id" do
101
- expect { @network.delete }.to raise_error(ArgumentError)
102
- @network.success.should be_false
103
- end
104
84
 
105
85
  it "deletes the network" do
106
86
  delete = @network.delete(16)
107
87
  @network.success.should be_true
108
88
  end
109
89
  end
90
+
91
+ describe "#rebuild" do
92
+ use_vcr_cassette 'network/rebuild'
93
+
94
+ it "rebuilds the network for VM" do
95
+ rebuild = @network.rebuild(58)
96
+ @network.success.should be_true
97
+ end
98
+ end
110
99
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Squall::NetworkZone do
4
4
  before(:each) do
5
5
  @network_zone = Squall::NetworkZone.new
6
- @valid = {:label => "My zone"}
6
+ @valid = {label: "My zone"}
7
7
  end
8
8
 
9
9
  describe "#list" do
@@ -22,9 +22,6 @@ describe Squall::NetworkZone do
22
22
 
23
23
  describe "#show" do
24
24
  use_vcr_cassette "network_zones/show"
25
- it "requires an id" do
26
- expect { @network_zone.show }.to raise_error(ArgumentError)
27
- end
28
25
 
29
26
  it "returns a network zone" do
30
27
  network_zones = @network_zone.show(1)
@@ -34,14 +31,6 @@ describe Squall::NetworkZone do
34
31
 
35
32
  describe "#create" do
36
33
  use_vcr_cassette "network_zones/create"
37
- it "requires label" do
38
- invalid = @valid.reject{|k,v| k == :label }
39
- requires_attr(:label) { @network_zone.create(invalid) }
40
- end
41
-
42
- it "raises error on unknown params" do
43
- expect { @network_zone.create(@valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
44
- end
45
34
 
46
35
  it "creates a network zone" do
47
36
  @network_zone.create(@valid)
@@ -60,21 +49,14 @@ describe Squall::NetworkZone do
60
49
  end
61
50
  end
62
51
 
63
- it "raises error on unknown params" do
64
- expect { @network_zone.edit(1, @valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
65
- end
66
-
67
52
  it "edits a network zone" do
68
- @network_zone.edit(1, :label => "Updated zone")
53
+ @network_zone.edit(1, label: "Updated zone")
69
54
  @network_zone.success.should be_true
70
55
  end
71
56
  end
72
57
 
73
58
  describe "#delete" do
74
59
  use_vcr_cassette "network_zones/delete"
75
- it "requires an id" do
76
- expect { @network_zone.delete }.to raise_error(ArgumentError)
77
- end
78
60
 
79
61
  it "deletes a network zone" do
80
62
  @network_zone.delete(1)
@@ -85,14 +67,6 @@ describe Squall::NetworkZone do
85
67
  describe "#attach" do
86
68
  use_vcr_cassette "network_zones/attach"
87
69
 
88
- it "requires an id" do
89
- expect { @network_zone.attach }.to raise_error(ArgumentError)
90
- end
91
-
92
- it "requires a network id" do
93
- expect { @network_zone.attach(1) }.to raise_error(ArgumentError)
94
- end
95
-
96
70
  it "attaches a network to the network zone" do
97
71
  request = @network_zone.attach(1, 2)
98
72
  @network_zone.success.should be_true
@@ -102,14 +76,6 @@ describe Squall::NetworkZone do
102
76
  describe "#detach" do
103
77
  use_vcr_cassette "network_zones/detach"
104
78
 
105
- it "requires an id" do
106
- expect { @network_zone.detach }.to raise_error(ArgumentError)
107
- end
108
-
109
- it "requires a network id" do
110
- expect { @network_zone.detach(1) }.to raise_error(ArgumentError)
111
- end
112
-
113
79
  it "detaches a network to the network zone" do
114
80
  request = @network_zone.detach(1, 2)
115
81
  @network_zone.success.should be_true
@@ -4,16 +4,12 @@ describe Squall::Payment do
4
4
  before(:each) do
5
5
  @keys = ["amount", "invoice_number"]
6
6
  @payment = Squall::Payment.new
7
- @valid = {:amount => 500}
7
+ @valid = {amount: 500}
8
8
  end
9
9
 
10
10
  describe "#list" do
11
11
  use_vcr_cassette "payment/list"
12
12
 
13
- it "requires user id" do
14
- expect { @payment.list }.to raise_error(ArgumentError)
15
- end
16
-
17
13
  it "returns a user list" do
18
14
  payments = @payment.list(1)
19
15
  payments.should be_an(Array)
@@ -27,10 +23,6 @@ describe Squall::Payment do
27
23
 
28
24
  describe "#create" do
29
25
  use_vcr_cassette "payment/create"
30
- it "requires amount" do
31
- invalid = @valid.reject{|k,v| k == :amount }
32
- requires_attr(:amount) { @payment.create(1, invalid) }
33
- end
34
26
 
35
27
  it "allows all optional params" do
36
28
  optional = [:invoice_number]
@@ -40,10 +32,6 @@ describe Squall::Payment do
40
32
  end
41
33
  end
42
34
 
43
- it "raises error on unknown params" do
44
- expect { @payment.create(1, @valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
45
- end
46
-
47
35
  it "creates a payment for a user" do
48
36
  user = @payment.create(1, @valid)
49
37
  @payment.success.should be_true
@@ -61,21 +49,14 @@ describe Squall::Payment do
61
49
  end
62
50
  end
63
51
 
64
- it "raises error on unknown params" do
65
- expect { @payment.edit(1, 1, :what => 'what') }.to raise_error(ArgumentError, 'Unknown params: what')
66
- end
67
-
68
52
  it "edits a payment" do
69
- user = @payment.edit(1, 1, :amount => 100)
53
+ user = @payment.edit(1, 1, amount: 100)
70
54
  @payment.success.should be_true
71
55
  end
72
56
  end
73
57
 
74
58
  describe "#delete" do
75
59
  use_vcr_cassette "payment/delete"
76
- it "requires an id" do
77
- expect { @payment.delete }.to raise_error(ArgumentError)
78
- end
79
60
 
80
61
  it "deletes a payment" do
81
62
  @payment.delete(1, 1)
@@ -7,6 +7,7 @@ describe Squall::Role do
7
7
 
8
8
  describe "#list" do
9
9
  use_vcr_cassette "role/list"
10
+
10
11
  it "returns roles" do
11
12
  roles = @role.list
12
13
  roles.all?{|r| r.first == "role"}
@@ -15,9 +16,6 @@ describe Squall::Role do
15
16
 
16
17
  describe "#show" do
17
18
  use_vcr_cassette "role/show"
18
- it "requires an id" do
19
- expect { @role.show }.to raise_error(ArgumentError)
20
- end
21
19
 
22
20
  it "returns a role" do
23
21
  role = @role.show(1)
@@ -27,9 +25,6 @@ describe Squall::Role do
27
25
 
28
26
  describe "#edit" do
29
27
  use_vcr_cassette "role/edit"
30
- it "requires an id" do
31
- expect { @role.edit }.to raise_error(ArgumentError)
32
- end
33
28
 
34
29
  it "allows all optional params" do
35
30
  optional = [:label, :permission_ids]
@@ -42,7 +37,7 @@ describe Squall::Role do
42
37
 
43
38
  it "updates the role" do
44
39
  pending "OnApp is returning an empty response" do
45
- role = @role.edit(1, :label => 'New')
40
+ role = @role.edit(1, label: 'New')
46
41
  role['label'].should == 'New'
47
42
  end
48
43
  end
@@ -50,9 +45,6 @@ describe Squall::Role do
50
45
 
51
46
  describe "#delete" do
52
47
  use_vcr_cassette "role/delete"
53
- it "requires an id" do
54
- expect { @role.delete }.to raise_error(ArgumentError)
55
- end
56
48
 
57
49
  it "returns a role" do
58
50
  role = @role.delete(3)
@@ -78,17 +70,13 @@ describe Squall::Role do
78
70
  describe "#create" do
79
71
  use_vcr_cassette "role/create"
80
72
 
81
- it "requires label" do
82
- requires_attr(:label) { @role.create }
83
- end
84
-
85
73
  it "allows permission_ids" do
86
74
  @role.should_receive(:request).once.and_return Hash.new('role' => [])
87
- @role.create(:label => "test", :permission_ids => 1)
75
+ @role.create(label: "test", permission_ids: 1)
88
76
  end
89
77
 
90
78
  it "creates a role" do
91
- response = @role.create({:label => 'Test Create', :permission_ids => 1})
79
+ response = @role.create({label: 'Test Create', permission_ids: 1})
92
80
  response["role"]['label'].should == 'Test Create'
93
81
  response["role"]['permissions'].should_not be_empty
94
82
  end
@@ -15,7 +15,7 @@ describe Squall::Base do
15
15
  describe "#request" do
16
16
  it "200-207 returns success" do
17
17
  (200..207).each do |i|
18
- mock_request(:get, "/#{i}", :status => [i, "OK"], :body => "{\"something\":[\"OK\"]}")
18
+ mock_request(:get, "/#{i}", status: [i, "OK"], body: "{\"something\":[\"OK\"]}")
19
19
  base = Squall::Base.new
20
20
  base.request(:get, "/#{i}")
21
21
  base.success.should be_true
@@ -23,7 +23,7 @@ describe Squall::Base do
23
23
  end
24
24
 
25
25
  it "raises NotFound for 404s" do
26
- mock_request(:get, '/404', :status => [404, "NotFound"], :body => "{\"errors\":[\"Resource not found\"]}")
26
+ mock_request(:get, '/404', status: [404, "NotFound"], body: "{\"errors\":[\"Resource not found\"]}")
27
27
  @base.request(:get, '/404')
28
28
 
29
29
  @base.success.should be_false
@@ -31,7 +31,7 @@ describe Squall::Base do
31
31
  end
32
32
 
33
33
  it "raises ServerError on errors" do
34
- mock_request(:get, '/500', :status => [500, "Internal Server Error"], :body => "{\"errors\":[\"Internal Server Error\"]}")
34
+ mock_request(:get, '/500', status: [500, "Internal Server Error"], body: "{\"errors\":[\"Internal Server Error\"]}")
35
35
  @base.request(:get, '/500')
36
36
 
37
37
  @base.success.should be_false
@@ -39,7 +39,7 @@ describe Squall::Base do
39
39
  end
40
40
 
41
41
  it "raises RequestError on errors" do
42
- mock_request(:get, '/422', :status => [422, "Unprocessable"], :body => "{\"errors\":[\"Unprocessable\"]}")
42
+ mock_request(:get, '/422', status: [422, "Unprocessable"], body: "{\"errors\":[\"Unprocessable\"]}")
43
43
  @base.request(:get, '/422')
44
44
 
45
45
  @base.success.should be_false
@@ -52,12 +52,6 @@ describe Squall::Base do
52
52
  end
53
53
  end
54
54
 
55
- describe "#params" do
56
- it "returns Params.new" do
57
- @base.params.should be_a(Squall::Params)
58
- end
59
- end
60
-
61
55
  describe "#default_params" do
62
56
  it "sets the default options" do
63
57
  @base.default_params.should == {}
@@ -65,22 +59,22 @@ describe Squall::Base do
65
59
 
66
60
  it "merges the query in" do
67
61
  expected = {
68
- :query => {
69
- :base => {:one => 1, :two => 2}
62
+ query: {
63
+ base: {one: 1, two: 2}
70
64
  }
71
65
  }
72
- @base.default_params(:one => 1, :two => 2).should include(expected)
66
+ @base.default_params(one: 1, two: 2).should include(expected)
73
67
  end
74
68
 
75
69
  it "uses the subclass name as the key" do
76
70
  base_test = CamelTest.new
77
71
  base_test.default_params.should == {}
78
72
  expected = {
79
- :query => {
80
- :camel_test => {:one => 1, :two => 2}
73
+ query: {
74
+ camel_test: {one: 1, two: 2}
81
75
  }
82
76
  }
83
- base_test.default_params(:one => 1, :two => 2).should include(expected)
77
+ base_test.default_params(one: 1, two: 2).should include(expected)
84
78
  end
85
79
  end
86
80
 
@@ -24,10 +24,6 @@ describe Squall::Template do
24
24
 
25
25
  describe "#make_public" do
26
26
  use_vcr_cassette 'template/make_public'
27
- it "requires an id" do
28
- expect { @template.make_public }.to raise_error(ArgumentError)
29
- @template.success.should be_false
30
- end
31
27
 
32
28
  it "makes the template public" do
33
29
  pub = @template.make_public(1)
@@ -11,6 +11,7 @@ describe Squall::Transaction do
11
11
 
12
12
  describe "#list" do
13
13
  use_vcr_cassette 'transaction/list'
14
+
14
15
  it "lists transactions" do
15
16
  list = @transaction.list
16
17
  list.size.should be(3)
@@ -22,9 +23,6 @@ describe Squall::Transaction do
22
23
 
23
24
  describe "#show" do
24
25
  use_vcr_cassette "transaction/show"
25
- it "requires an id" do
26
- expect { @transaction.show }.to raise_error(ArgumentError)
27
- end
28
26
 
29
27
  it "returns a transaction" do
30
28
  transaction = @transaction.show(1)
@@ -4,7 +4,7 @@ describe Squall::UserGroup do
4
4
  before(:each) do
5
5
  @keys = ["amount"]
6
6
  @user_group = Squall::UserGroup.new
7
- @valid = {:label => "My new group"}
7
+ @valid = {label: "My new group"}
8
8
  end
9
9
 
10
10
  describe "#list" do
@@ -23,14 +23,6 @@ describe Squall::UserGroup do
23
23
 
24
24
  describe "#create" do
25
25
  use_vcr_cassette "user_group/create"
26
- it "requires label" do
27
- invalid = @valid.reject{|k,v| k == :label }
28
- requires_attr(:label) { @user_group.create(invalid) }
29
- end
30
-
31
- it "raises error on unknown params" do
32
- expect { @user_group.create(@valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
33
- end
34
26
 
35
27
  it "creates a user group" do
36
28
  @user_group.create(@valid)
@@ -41,10 +33,6 @@ describe Squall::UserGroup do
41
33
  describe "#edit" do
42
34
  use_vcr_cassette "user_group/edit"
43
35
 
44
- it "raises error on unknown params" do
45
- expect { @user_group.edit(1, :what => 'what') }.to raise_error(ArgumentError, 'Unknown params: what')
46
- end
47
-
48
36
  it "edits a user group" do
49
37
  @user_group.edit(1, @valid)
50
38
  @user_group.success.should be_true
@@ -53,14 +41,10 @@ describe Squall::UserGroup do
53
41
 
54
42
  describe "#delete" do
55
43
  use_vcr_cassette "user_group/delete"
56
- it "requires an id" do
57
- expect { @user_group.delete }.to raise_error(ArgumentError)
58
- end
59
44
 
60
45
  it "deletes a user group" do
61
46
  @user_group.delete(1)
62
47
  @user_group.success.should be_true
63
48
  end
64
49
  end
65
-
66
50
  end