mailgun 0.8 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,156 +5,156 @@ describe Multiset do
5
5
 
6
6
  it "should return the multiplicity of the element" do
7
7
  set = Multiset.new([:a, :a, :b, :b, :b, :c])
8
- set.multiplicity(:a).should eql(2)
9
- set.multiplicity(:b).should eql(3)
10
- set.multiplicity(:c).should eql(1)
8
+ expect(set.multiplicity(:a)).to eql(2)
9
+ expect(set.multiplicity(:b)).to eql(3)
10
+ expect(set.multiplicity(:c)).to eql(1)
11
11
  end
12
12
 
13
13
  it "should return the cardinality of the set" do
14
14
  set = Multiset.new([:a, :a, :b, :b, :b, :c])
15
- set.cardinality.should eql(6)
15
+ expect(set.cardinality).to eql(6)
16
16
  end
17
17
 
18
18
  it "should be eql" do
19
19
  s1 = Multiset.new([:a, :b])
20
20
  s2 = Multiset.new([:b, :a])
21
- s1.should eql(s2)
21
+ expect(s1).to eql(s2)
22
22
 
23
23
  s1 = Multiset.new([:a, :a])
24
24
  s2 = Multiset.new([:a])
25
- s1.should_not eql(s2)
25
+ expect(s1).to_not eql(s2)
26
26
  end
27
27
 
28
28
  it "should replace the contents of the set" do
29
29
  set = Multiset[:a, :b, :b, :c]
30
30
  ret = set.replace(Multiset[:a, :a, :b, :b, :b, :c])
31
31
 
32
- set.should equal(ret)
33
- set.should eql(Multiset[:a, :a, :b, :b, :b, :c])
32
+ expect(set).to equal(ret)
33
+ expect(set).to eql(Multiset[:a, :a, :b, :b, :b, :c])
34
34
 
35
35
  set = Multiset[:a, :b, :b, :c]
36
36
  ret = set.replace([:a, :a, :b, :b, :b, :c])
37
37
 
38
- set.should equal(ret)
39
- set.should eql(Multiset[:a, :a, :b, :b, :b, :c])
38
+ expect(set).to equal(ret)
39
+ expect(set).to eql(Multiset[:a, :a, :b, :b, :b, :c])
40
40
  end
41
41
 
42
42
  it "should return true if the set is a superset of the given set" do
43
43
  set = Multiset[1, 2, 2, 3]
44
44
 
45
- set.superset?(Multiset[]).should be_true
46
- set.superset?(Multiset[1, 2]).should be_true
47
- set.superset?(Multiset[1, 2, 3]).should be_true
48
- set.superset?(Multiset[1, 2, 2, 3]).should be_true
49
- set.superset?(Multiset[1, 2, 2, 2]).should be_false
50
- set.superset?(Multiset[1, 2, 3, 4]).should be_false
51
- set.superset?(Multiset[1, 4]).should be_false
45
+ expect(set.superset?(Multiset[])).to be_true
46
+ expect(set.superset?(Multiset[1, 2])).to be_true
47
+ expect(set.superset?(Multiset[1, 2, 3])).to be_true
48
+ expect(set.superset?(Multiset[1, 2, 2, 3])).to be_true
49
+ expect(set.superset?(Multiset[1, 2, 2, 2])).to be_false
50
+ expect(set.superset?(Multiset[1, 2, 3, 4])).to be_false
51
+ expect(set.superset?(Multiset[1, 4])).to be_false
52
52
  end
53
53
 
54
54
  it "should return true if the set is a proper superset of the given set" do
55
55
  set = Multiset[1, 2, 2, 3, 3]
56
56
 
57
- set.proper_superset?(Multiset[]).should be_true
58
- set.proper_superset?(Multiset[1, 2]).should be_true
59
- set.proper_superset?(Multiset[1, 2, 3]).should be_true
60
- set.proper_superset?(Multiset[1, 2, 2, 3, 3]).should be_false
61
- set.proper_superset?(Multiset[1, 2, 2, 2]).should be_false
62
- set.proper_superset?(Multiset[1, 2, 3, 4]).should be_false
63
- set.proper_superset?(Multiset[1, 4]).should be_false
57
+ expect(set.proper_superset?(Multiset[])).to be_true
58
+ expect(set.proper_superset?(Multiset[1, 2])).to be_true
59
+ expect(set.proper_superset?(Multiset[1, 2, 3])).to be_true
60
+ expect(set.proper_superset?(Multiset[1, 2, 2, 3, 3])).to be_false
61
+ expect(set.proper_superset?(Multiset[1, 2, 2, 2])).to be_false
62
+ expect(set.proper_superset?(Multiset[1, 2, 3, 4])).to be_false
63
+ expect(set.proper_superset?(Multiset[1, 4])).to be_false
64
64
  end
65
65
 
66
66
  it "should return true if the set is a subset of the given set" do
67
67
  set = Multiset[1, 2, 2, 3]
68
68
 
69
- set.subset?(Multiset[1, 2, 2, 3, 4]).should be_true
70
- set.subset?(Multiset[1, 2, 2, 3, 3]).should be_true
71
- set.subset?(Multiset[1, 2, 2, 3]).should be_true
72
- set.subset?(Multiset[1, 2, 3]).should be_false
73
- set.subset?(Multiset[1, 2, 2]).should be_false
74
- set.subset?(Multiset[1, 2, 3]).should be_false
75
- set.subset?(Multiset[]).should be_false
69
+ expect(set.subset?(Multiset[1, 2, 2, 3, 4])).to be_true
70
+ expect(set.subset?(Multiset[1, 2, 2, 3, 3])).to be_true
71
+ expect(set.subset?(Multiset[1, 2, 2, 3])).to be_true
72
+ expect(set.subset?(Multiset[1, 2, 3])).to be_false
73
+ expect(set.subset?(Multiset[1, 2, 2])).to be_false
74
+ expect(set.subset?(Multiset[1, 2, 3])).to be_false
75
+ expect(set.subset?(Multiset[])).to be_false
76
76
  end
77
77
 
78
78
  it "should return true if the set is a proper subset of the given set" do
79
79
  set = Multiset[1, 2, 2, 3, 3]
80
80
 
81
- set.proper_subset?(Multiset[1, 2, 2, 3, 3, 4]).should be_true
82
- set.proper_subset?(Multiset[1, 2, 2, 3, 3]).should be_false
83
- set.proper_subset?(Multiset[1, 2, 3]).should be_false
84
- set.proper_subset?(Multiset[1, 2, 2]).should be_false
85
- set.proper_subset?(Multiset[1, 2, 3]).should be_false
86
- set.proper_subset?(Multiset[]).should be_false
81
+ expect(set.proper_subset?(Multiset[1, 2, 2, 3, 3, 4])).to be_true
82
+ expect(set.proper_subset?(Multiset[1, 2, 2, 3, 3])).to be_false
83
+ expect(set.proper_subset?(Multiset[1, 2, 3])).to be_false
84
+ expect(set.proper_subset?(Multiset[1, 2, 2])).to be_false
85
+ expect(set.proper_subset?(Multiset[1, 2, 3])).to be_false
86
+ expect(set.proper_subset?(Multiset[])).to be_false
87
87
  end
88
88
 
89
89
  it "should delete the objects from the set and return self" do
90
90
  set = Multiset[1, 2, 2, 3]
91
91
 
92
92
  ret = set.delete(4)
93
- set.should equal(ret)
94
- set.should eql(Multiset[1, 2, 2, 3])
93
+ expect(set).to equal(ret)
94
+ expect(set).to eql(Multiset[1, 2, 2, 3])
95
95
 
96
96
  ret = set.delete(2)
97
- set.should eql(ret)
98
- set.should eql(Multiset[1, 3])
97
+ expect(set).to eql(ret)
98
+ expect(set).to eql(Multiset[1, 3])
99
99
  end
100
100
 
101
101
  it "should delete the number objects from the set and return self" do
102
102
  set = Multiset[1, 2, 2, 3]
103
103
 
104
104
  ret = set.delete(2, 1)
105
- set.should eql(ret)
106
- set.should eql(Multiset[1, 2, 3])
105
+ expect(set).to eql(ret)
106
+ expect(set).to eql(Multiset[1, 2, 3])
107
107
  end
108
108
 
109
109
  it "should merge the elements of the given enumerable object to the set and return self" do
110
110
  set = Multiset[1, 2, 3]
111
111
  ret = set.merge([2, 4, 5])
112
- set.should equal(ret)
113
- set.should eql(Multiset[1, 2, 2, 3, 4, 5])
112
+ expect(set).to equal(ret)
113
+ expect(set).to eql(Multiset[1, 2, 2, 3, 4, 5])
114
114
 
115
115
  set = Multiset[1, 2, 3]
116
116
  ret = set.merge(Multiset[2, 4, 5])
117
- set.should equal(ret)
118
- set.should eql(Multiset[1, 2, 2, 3, 4, 5])
117
+ expect(set).to equal(ret)
118
+ expect(set).to eql(Multiset[1, 2, 2, 3, 4, 5])
119
119
  end
120
120
 
121
121
  it "should delete every element that appears in the given enumerable object and return self" do
122
122
  set = Multiset[1, 2, 2, 3]
123
123
  ret = set.subtract([2, 4, 6])
124
- set.should equal(ret)
125
- set.should eql(Multiset[1, 2, 3])
124
+ expect(set).to equal(ret)
125
+ expect(set).to eql(Multiset[1, 2, 3])
126
126
  end
127
127
 
128
128
  it "should return a new set containing elements common to the set and the given enumerable object" do
129
129
  set = Multiset[1, 2, 2, 3, 4]
130
130
 
131
131
  ret = set & [2, 2, 4, 5]
132
- set.should_not equal(ret)
133
- ret.should eql(Multiset[2, 2, 4])
132
+ expect(set).to_not equal(ret)
133
+ expect(ret).to eql(Multiset[2, 2, 4])
134
134
 
135
135
  set = Multiset[1, 2, 3]
136
136
 
137
137
  ret = set & [1, 2, 2, 2]
138
- set.should_not equal(ret)
139
- ret.should eql(Multiset[1, 2])
138
+ expect(set).to_not equal(ret)
139
+ expect(ret).to eql(Multiset[1, 2])
140
140
  end
141
141
 
142
142
  it "should return a new set containing elements exclusive between the set and the given enumerable object" do
143
143
  set = Multiset[1, 2, 3, 4, 5]
144
144
  ret = set ^ [2, 4, 5, 5]
145
- set.should_not equal(ret)
146
- ret.should eql(Multiset[1, 3, 5])
145
+ expect(set).to_not equal(ret)
146
+ expect(ret).to eql(Multiset[1, 3, 5])
147
147
 
148
148
  set = Multiset[1, 2, 4, 5, 5]
149
149
  ret = set ^ [2, 3, 4, 5]
150
- set.should_not equal(ret)
151
- ret.should eql(Multiset[1, 3, 5])
150
+ expect(set).to_not equal(ret)
151
+ expect(ret).to eql(Multiset[1, 3, 5])
152
152
  end
153
153
 
154
154
  it "should marshal set" do
155
155
  set = Multiset[1, 2, 3, 4, 5]
156
156
  data = Marshal.dump(set)
157
- Marshal.load(data).should eql(set)
157
+ expect(Marshal.load(data)).to eql(set)
158
158
  end
159
159
 
160
160
  it "should dump yaml" do
@@ -162,7 +162,7 @@ describe Multiset do
162
162
 
163
163
  set = Multiset[1, 2, 3, 4, 5]
164
164
  data = YAML.dump(set)
165
- YAML.load(data).should eql(set)
165
+ expect(YAML.load(data)).to eql(set)
166
166
  end
167
167
  end
168
168
 
@@ -174,11 +174,11 @@ describe Multiset, "with inital values" do
174
174
  end
175
175
 
176
176
  it "should return the multiplicity of the element" do
177
- @set.multiplicity(1).should eql(1)
178
- @set.multiplicity(2).should eql(1)
177
+ expect(@set.multiplicity(1)).to eql(1)
178
+ expect(@set.multiplicity(2)).to eql(1)
179
179
  end
180
180
 
181
181
  it "should return the cardinality of the set" do
182
- @set.cardinality.should eql(2)
182
+ expect(@set.cardinality).to eql(2)
183
183
  end
184
184
  end
@@ -10,54 +10,54 @@ describe NestedMultimap, "with inital values" do
10
10
 
11
11
  it "should set value at nested key" do
12
12
  @map["foo", "bar", "baz"] = 100
13
- @map["foo", "bar", "baz"].should eql([100])
13
+ expect(@map["foo", "bar", "baz"]).to eql([100])
14
14
  end
15
15
 
16
16
  it "should allow nil keys to be set" do
17
17
  @map["b", nil] = 400
18
18
  @map["b", "c"] = 500
19
19
 
20
- @map["a"].should eql([100])
21
- @map["b"].should eql([200, 300])
22
- @map["b", nil].should eql([200, 300, 400])
23
- @map["b", "c"].should eql([200, 300, 500])
20
+ expect(@map["a"]).to eql([100])
21
+ expect(@map["b"]).to eql([200, 300])
22
+ expect(@map["b", nil]).to eql([200, 300, 400])
23
+ expect(@map["b", "c"]).to eql([200, 300, 500])
24
24
  end
25
25
 
26
26
  it "should treat missing keys as append to all" do
27
27
  @map[] = 400
28
- @map["a"].should eql([100, 400])
29
- @map["b"].should eql([200, 300, 400])
30
- @map["c"].should eql([400])
31
- @map[nil].should eql([400])
28
+ expect(@map["a"]).to eql([100, 400])
29
+ expect(@map["b"]).to eql([200, 300, 400])
30
+ expect(@map["c"]).to eql([400])
31
+ expect(@map[nil]).to eql([400])
32
32
  end
33
33
 
34
34
  it "should append the value to default containers" do
35
35
  @map << 400
36
- @map["a"].should eql([100, 400])
37
- @map["b"].should eql([200, 300, 400])
38
- @map["c"].should eql([400])
39
- @map[nil].should eql([400])
36
+ expect(@map["a"]).to eql([100, 400])
37
+ expect(@map["b"]).to eql([200, 300, 400])
38
+ expect(@map["c"]).to eql([400])
39
+ expect(@map[nil]).to eql([400])
40
40
  end
41
41
 
42
42
  it "should append the value to all containers" do
43
43
  @map << 500
44
- @map["a"].should eql([100, 500])
45
- @map["b"].should eql([200, 300, 500])
46
- @map[nil].should eql([500])
44
+ expect(@map["a"]).to eql([100, 500])
45
+ expect(@map["b"]).to eql([200, 300, 500])
46
+ expect(@map[nil]).to eql([500])
47
47
  end
48
48
 
49
49
  it "default values should be copied to new containers" do
50
50
  @map << 300
51
51
  @map["x"] = 100
52
- @map["x"].should eql([300, 100])
52
+ expect(@map["x"]).to eql([300, 100])
53
53
  end
54
54
 
55
55
  it "should list all containers" do
56
- @map.containers.should sorted_eql([[100], [200, 300]])
56
+ expect(@map.containers).to sorted_eql([[100], [200, 300]])
57
57
  end
58
58
 
59
59
  it "should list all values" do
60
- @map.values.should sorted_eql([100, 200, 300])
60
+ expect(@map.values).to sorted_eql([100, 200, 300])
61
61
  end
62
62
  end
63
63
 
@@ -72,52 +72,52 @@ describe NestedMultimap, "with nested values" do
72
72
  end
73
73
 
74
74
  it "should retrieve container of values for key" do
75
- @map["a"].should eql([100])
76
- @map["b"].should eql([200])
77
- @map["c"].should eql([500])
78
- @map["a", "b"].should eql([100])
79
- @map["b", "c"].should eql([200, 300])
80
- @map["c", "e"].should eql([400, 500])
75
+ expect(@map["a"]).to eql([100])
76
+ expect(@map["b"]).to eql([200])
77
+ expect(@map["c"]).to eql([500])
78
+ expect(@map["a", "b"]).to eql([100])
79
+ expect(@map["b", "c"]).to eql([200, 300])
80
+ expect(@map["c", "e"]).to eql([400, 500])
81
81
  end
82
82
 
83
83
  it "should append the value to default containers" do
84
84
  @map << 600
85
- @map["a"].should eql([100, 600])
86
- @map["b"].should eql([200, 600])
87
- @map["c"].should eql([500, 600])
88
- @map["a", "b"].should eql([100, 600])
89
- @map["b", "c"].should eql([200, 300, 600])
90
- @map["c", "e"].should eql([400, 500, 600])
91
- @map[nil].should eql([600])
85
+ expect(@map["a"]).to eql([100, 600])
86
+ expect(@map["b"]).to eql([200, 600])
87
+ expect(@map["c"]).to eql([500, 600])
88
+ expect(@map["a", "b"]).to eql([100, 600])
89
+ expect(@map["b", "c"]).to eql([200, 300, 600])
90
+ expect(@map["c", "e"]).to eql([400, 500, 600])
91
+ expect(@map[nil]).to eql([600])
92
92
  end
93
93
 
94
94
  it "should duplicate the containers" do
95
95
  map2 = @map.dup
96
- map2.should_not equal(@map)
97
- map2.should eql(@map)
96
+ expect(map2).to_not equal(@map)
97
+ expect(map2).to eql(@map)
98
98
 
99
- map2["a"].should eql([100])
100
- map2["b"].should eql([200])
101
- map2["c"].should eql([500])
102
- map2["a", "b"].should eql([100])
103
- map2["b", "c"].should eql([200, 300])
104
- map2["c", "e"].should eql([400, 500])
99
+ expect(map2["a"]).to eql([100])
100
+ expect(map2["b"]).to eql([200])
101
+ expect(map2["c"]).to eql([500])
102
+ expect(map2["a", "b"]).to eql([100])
103
+ expect(map2["b", "c"]).to eql([200, 300])
104
+ expect(map2["c", "e"]).to eql([400, 500])
105
105
 
106
- map2["a"].should_not equal(@map["a"])
107
- map2["b"].should_not equal(@map["b"])
108
- map2["c"].should_not equal(@map["c"])
109
- map2["a", "b"].should_not equal(@map["a", "b"])
110
- map2["b", "c"].should_not equal(@map["b", "c"])
111
- map2["c", "e"].should_not equal(@map["c", "e"])
106
+ expect(map2["a"]).to_not equal(@map["a"])
107
+ expect(map2["b"]).to_not equal(@map["b"])
108
+ expect(map2["c"]).to_not equal(@map["c"])
109
+ expect(map2["a", "b"]).to_not equal(@map["a", "b"])
110
+ expect(map2["b", "c"]).to_not equal(@map["b", "c"])
111
+ expect(map2["c", "e"]).to_not equal(@map["c", "e"])
112
112
 
113
- map2.default.should_not equal(@map.default)
114
- map2.default.should eql(@map.default)
113
+ expect(map2.default).to_not equal(@map.default)
114
+ expect(map2.default).to eql(@map.default)
115
115
  end
116
116
 
117
117
  it "should iterate over each key/value pair and yield an array" do
118
118
  a = []
119
119
  @map.each { |pair| a << pair }
120
- a.should sorted_eql([
120
+ expect(a).to sorted_eql([
121
121
  ["a", 100],
122
122
  [["b", "c"], 200],
123
123
  [["b", "c"], 300],
@@ -129,7 +129,7 @@ describe NestedMultimap, "with nested values" do
129
129
  it "should iterate over each key/container" do
130
130
  a = []
131
131
  @map.each_association { |key, container| a << [key, container] }
132
- a.should sorted_eql([
132
+ expect(a).to sorted_eql([
133
133
  ["a", [100]],
134
134
  [["b", "c"], [200, 300]],
135
135
  [["c", "e"], [400, 500]]
@@ -139,7 +139,7 @@ describe NestedMultimap, "with nested values" do
139
139
  it "should iterate over each container plus the default" do
140
140
  a = []
141
141
  @map.each_container_with_default { |container| a << container }
142
- a.should sorted_eql([
142
+ expect(a).to sorted_eql([
143
143
  [100],
144
144
  [200, 300],
145
145
  [200],
@@ -152,13 +152,13 @@ describe NestedMultimap, "with nested values" do
152
152
  it "should iterate over each key" do
153
153
  a = []
154
154
  @map.each_key { |key| a << key }
155
- a.should sorted_eql(["a", ["b", "c"], ["b", "c"], ["c", "e"], ["c", "e"]])
155
+ expect(a).to sorted_eql(["a", ["b", "c"], ["b", "c"], ["c", "e"], ["c", "e"]])
156
156
  end
157
157
 
158
158
  it "should iterate over each key/value pair and yield the pair" do
159
159
  h = {}
160
160
  @map.each_pair { |key, value| (h[key] ||= []) << value }
161
- h.should eql({
161
+ expect(h).to eql({
162
162
  "a" => [100],
163
163
  ["c", "e"] => [400, 500],
164
164
  ["b", "c"] => [200, 300]
@@ -168,23 +168,23 @@ describe NestedMultimap, "with nested values" do
168
168
  it "should iterate over each value" do
169
169
  a = []
170
170
  @map.each_value { |value| a << value }
171
- a.should sorted_eql([100, 200, 300, 400, 500])
171
+ expect(a).to sorted_eql([100, 200, 300, 400, 500])
172
172
  end
173
173
 
174
174
  it "should list all containers" do
175
- @map.containers.should sorted_eql([[100], [200, 300], [400, 500]])
175
+ expect(@map.containers).to sorted_eql([[100], [200, 300], [400, 500]])
176
176
  end
177
177
 
178
178
  it "should list all containers plus the default" do
179
- @map.containers_with_default.should sorted_eql([[100], [200, 300], [200], [400, 500], [500], []])
179
+ expect(@map.containers_with_default).to sorted_eql([[100], [200, 300], [200], [400, 500], [500], []])
180
180
  end
181
181
 
182
182
  it "should return array of keys" do
183
- @map.keys.should eql(["a", ["b", "c"], ["b", "c"], ["c", "e"], ["c", "e"]])
183
+ expect(@map.keys).to eql(["a", ["b", "c"], ["b", "c"], ["c", "e"], ["c", "e"]])
184
184
  end
185
185
 
186
186
  it "should list all values" do
187
- @map.values.should sorted_eql([100, 200, 300, 400, 500])
187
+ expect(@map.values).to sorted_eql([100, 200, 300, 400, 500])
188
188
  end
189
189
  end
190
190