This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
/
limit_disk_spec.rb
103 lines (79 loc) · 1.99 KB
/
limit_disk_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# coding: UTF-8
require "spec_helper"
shared_examples "disk limiting" do
field :block_limit do
it_should_be_optional
it_should_be_typed_as_uint32
end
field :block do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :block_soft do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :block_hard do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :inode_limit do
it_should_be_optional
it_should_be_typed_as_uint32
end
field :inode do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :inode_soft do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :inode_hard do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :byte_limit do
it_should_be_optional
it_should_be_typed_as_uint32
end
field :byte do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :byte_soft do
it_should_be_optional
it_should_be_typed_as_uint64
end
field :byte_hard do
it_should_be_optional
it_should_be_typed_as_uint64
end
end
describe Warden::Protocol::LimitDiskRequest do
subject(:request) do
described_class.new(:handle => "handle")
end
it_should_behave_like "wrappable request"
its("class.type_camelized") { should == "LimitDisk" }
its("class.type_underscored") { should == "limit_disk" }
field :handle do
it_should_be_required
it_should_be_typed_as_string
end
it_should_behave_like "disk limiting"
it "should respond to #create_response" do
request.create_response.should be_a(Warden::Protocol::LimitDiskResponse)
end
end
describe Warden::Protocol::LimitDiskResponse do
subject(:response) do
described_class.new
end
it_should_behave_like "wrappable response"
its("class.type_camelized") { should == "LimitDisk" }
its("class.type_underscored") { should == "limit_disk" }
it { should be_ok }
it { should_not be_error }
it_should_behave_like "disk limiting"
end