mailgun 0.8 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,9 @@
1
1
  module Mailgun
2
2
  class Route
3
-
4
3
  def initialize(mailgun)
5
4
  @mailgun = mailgun
6
5
  end
7
-
6
+
8
7
  def list(options={})
9
8
  Mailgun.submit(:get, route_url, options)["items"] || []
10
9
  end
@@ -26,6 +25,8 @@ module Mailgun
26
25
  data['action'] = action
27
26
  end
28
27
 
28
+ data = data.to_hash
29
+
29
30
  # TODO: Raise an error or return false if unable to create route
30
31
  Mailgun.submit(:post, route_url, data)["route"]["id"]
31
32
  end
@@ -33,6 +34,8 @@ module Mailgun
33
34
  def update(route_id, params)
34
35
  data = ::Multimap.new
35
36
 
37
+ params = Hash[params.map{ |k, v| [k.to_s, v] }]
38
+
36
39
  ['priority', 'description'].each do |key|
37
40
  data[key] = params[key] if params.has_key?(key)
38
41
  end
@@ -47,13 +50,15 @@ module Mailgun
47
50
  end
48
51
  end
49
52
 
53
+ data = data.to_hash
54
+
50
55
  Mailgun.submit(:put, route_url(route_id), data)
51
56
  end
52
-
57
+
53
58
  def destroy(route_id)
54
59
  Mailgun.submit(:delete, route_url(route_id))["id"]
55
60
  end
56
-
61
+
57
62
  private
58
63
 
59
64
  def route_url(route_id=nil)
@@ -0,0 +1,30 @@
1
+ # verifySignature: function(timestamp, token, signature, minutes_offset) {
2
+ # var offset = Math.round((new Date()).getTime() / 1000) - (minutes_offset || 5) * 60;
3
+ # if(timestamp < offset)
4
+ # return false;
5
+ #
6
+ # var hmac = crypto.createHmac('sha256', api_key);
7
+ # hmac.update(timestamp + token);
8
+ # return signature == hmac.digest('hex');
9
+ # },
10
+
11
+ module Mailgun
12
+ class Secure
13
+ def initialize(mailgun)
14
+ @mailgun = mailgun
15
+ end
16
+
17
+ # check request auth
18
+ def check_request_auth(timestamp, token, signature, offset=-5)
19
+ if offset != 0
20
+ offset = Time.now.to_i + offset * 60
21
+ return false if timestamp < offset
22
+ end
23
+
24
+ return signature == OpenSSL::HMAC.hexdigest(
25
+ OpenSSL::Digest::Digest.new('sha256'),
26
+ Mailgun.api_key,
27
+ '%s%s' % [timestamp, token])
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,55 @@
1
+ module Mailgun
2
+ # Interface to manage webhooks
3
+ # https://documentation.mailgun.com/api-webhooks.html#webhooks
4
+ class Webhook
5
+ attr_accessor :default_webhook_url, :domain
6
+
7
+ # Used internally, called from Mailgun::Base
8
+ def initialize(mailgun, domain, url)
9
+ @mailgun = mailgun
10
+ @domain = domain
11
+ @default_webhook_url = url
12
+ end
13
+
14
+ # List of currently available webhooks
15
+ def available_ids
16
+ %w(bounce deliver drop spam unsubscribe click open).map(&:to_sym)
17
+ end
18
+
19
+ # Returns a list of webhooks set for the specified domain
20
+ def list
21
+ Mailgun.submit(:get, webhook_url)["webhooks"] || []
22
+ end
23
+
24
+ # Returns details about the webhook specified
25
+ def find(id)
26
+ Mailgun.submit :get, webhook_url(id)
27
+ end
28
+
29
+ # Creates a new webhook
30
+ # Note: Creating an Open or Click webhook will enable Open or Click tracking
31
+ def create(id, url=default_webhook_url)
32
+ params = {:id => id, :url => url}
33
+ Mailgun.submit :post, webhook_url, params
34
+ end
35
+
36
+ # Updates an existing webhook
37
+ def update(id, url=default_webhook_url)
38
+ params = {:url => url}
39
+ Mailgun.submit :put, webhook_url(id), params
40
+ end
41
+
42
+ # Deletes an existing webhook
43
+ # Note: Deleting an Open or Click webhook will disable Open or Click tracking
44
+ def delete(id)
45
+ Mailgun.submit :delete, webhook_url(id)
46
+ end
47
+
48
+ private
49
+
50
+ # Helper method to generate the proper url for Mailgun webhook API calls
51
+ def webhook_url(id=nil)
52
+ "#{@mailgun.base_url}/domains/#{domain}/webhooks#{'/' + id if id}"
53
+ end
54
+ end
55
+ end
@@ -1,50 +1,50 @@
1
1
  shared_examples_for Enumerable, Multimap, "with inital values {'a' => [100], 'b' => [200, 300]}" do
2
2
  it "should check all key/value pairs for condition" do
3
- @map.all? { |key, value| key =~ /\w/ }.should be_true
4
- @map.all? { |key, value| key =~ /\d/ }.should be_false
5
- @map.all? { |key, value| value > 0 }.should be_true
6
- @map.all? { |key, value| value > 200 }.should be_false
3
+ expect(@map.all? { |key, value| key =~ /\w/ }).to be_true
4
+ expect(@map.all? { |key, value| key =~ /\d/ }).to be_false
5
+ expect(@map.all? { |key, value| value > 0 }).to be_true
6
+ expect(@map.all? { |key, value| value > 200 }).to be_false
7
7
  end
8
8
 
9
9
  it "should check any key/value pairs for condition" do
10
- @map.any? { |key, value| key == "a" }.should be_true
11
- @map.any? { |key, value| key == "z" }.should be_false
12
- @map.any? { |key, value| value == 100 }.should be_true
13
- @map.any? { |key, value| value > 1000 }.should be_false
10
+ expect(@map.any? { |key, value| key == "a" }).to be_true
11
+ expect(@map.any? { |key, value| key == "z" }).to be_false
12
+ expect(@map.any? { |key, value| value == 100 }).to be_true
13
+ expect(@map.any? { |key, value| value > 1000 }).to be_false
14
14
  end
15
15
 
16
16
  it "should collect key/value pairs" do
17
- @map.collect { |key, value| [key, value] }.should sorted_eql([["a", 100], ["b", 200], ["b", 300]])
18
- @map.map { |key, value| [key, value] }.should sorted_eql([["a", 100], ["b", 200], ["b", 300]])
17
+ expect(@map.collect { |key, value| [key, value] }).to sorted_eql([["a", 100], ["b", 200], ["b", 300]])
18
+ expect(@map.map { |key, value| [key, value] }).to sorted_eql([["a", 100], ["b", 200], ["b", 300]])
19
19
  end
20
20
 
21
21
  it "should detect key/value pair" do
22
- @map.detect { |key, value| value > 200 }.should eql(["b", 300])
23
- @map.find { |key, value| value > 200 }.should eql(["b", 300])
22
+ expect(@map.detect { |key, value| value > 200 }).to eql(["b", 300])
23
+ expect(@map.find { |key, value| value > 200 }).to eql(["b", 300])
24
24
  end
25
25
 
26
26
  it "should return entries" do
27
- @map.entries.should sorted_eql([["a", 100], ["b", 200], ["b", 300]])
28
- @map.to_a.should sorted_eql([["a", 100], ["b", 200], ["b", 300]])
27
+ expect(@map.entries).to sorted_eql([["a", 100], ["b", 200], ["b", 300]])
28
+ expect(@map.to_a).to sorted_eql([["a", 100], ["b", 200], ["b", 300]])
29
29
  end
30
30
 
31
31
  it "should find all key/value pairs" do
32
- @map.find_all { |key, value| value >= 200 }.should eql([["b", 200], ["b", 300]])
33
- @map.select { |key, value| value >= 200 }.should eql(Multimap["b", [200, 300]])
32
+ expect(@map.find_all { |key, value| value >= 200 }).to eql([["b", 200], ["b", 300]])
33
+ expect(@map.select { |key, value| value >= 200 }).to eql(Multimap["b", [200, 300]])
34
34
  end
35
35
 
36
36
  it "should combine key/value pairs with inject" do
37
- @map.inject(0) { |sum, (key, value)| sum + value }.should eql(600)
37
+ expect(@map.inject(0) { |sum, (key, value)| sum + value }).to eql(600)
38
38
 
39
39
  @map.inject(0) { |memo, (key, value)|
40
40
  memo > value ? memo : value
41
- }.should eql(300)
41
+ expect(}).to eql(300)
42
42
  end
43
43
 
44
44
  it "should check for key membership" do
45
- @map.member?("a").should be_true
46
- @map.include?("a").should be_true
47
- @map.member?("z").should be_false
48
- @map.include?("z").should be_false
45
+ expect(@map.member?("a")).to be_true
46
+ expect(@map.include?("a")).to be_true
47
+ expect(@map.member?("z")).to be_false
48
+ expect(@map.include?("z")).to be_false
49
49
  end
50
50
  end
@@ -8,152 +8,152 @@ shared_examples_for Hash, Multimap, "with inital values {'a' => [100], 'b' => [2
8
8
  map2["a"] = 100
9
9
  map2["b"] = 200
10
10
  map2["b"] = 300
11
- @map.should eql(map2)
11
+ expect(@map).to eql(map2)
12
12
  end
13
13
 
14
14
  it "should not be equal to another Multimap if they contain different values" do
15
- @map.should_not == Multimap["a" => [100], "b" => [200]]
15
+ expect(@map).to_not == Multimap["a" => [100], "b" => [200]]
16
16
  end
17
17
 
18
18
  it "should retrieve container of values for key" do
19
- @map["a"].should eql(@container.new([100]))
20
- @map["b"].should eql(@container.new([200, 300]))
21
- @map["z"].should eql(@container.new)
19
+ expect(@map["a"]).to eql(@container.new([100]))
20
+ expect(@map["b"]).to eql(@container.new([200, 300]))
21
+ expect(@map["z"]).to eql(@container.new)
22
22
  end
23
23
 
24
24
  it "should append values to container at key" do
25
25
  @map["a"] = 400
26
26
  @map.store("b", 500)
27
- @map["a"].should eql(@container.new([100, 400]))
28
- @map["b"].should eql(@container.new([200, 300, 500]))
27
+ expect(@map["a"]).to eql(@container.new([100, 400]))
28
+ expect(@map["b"]).to eql(@container.new([200, 300, 500]))
29
29
  end
30
30
 
31
31
  it "should clear all key/values" do
32
32
  @map.clear
33
- @map.should be_empty
33
+ expect(@map).to be_empty
34
34
  end
35
35
 
36
36
  it "should be the class of the container" do
37
- @map.default.class.should eql(@container)
37
+ expect(@map.default.class).to eql(@container)
38
38
  end
39
39
 
40
40
  it "should delete all values at key" do
41
41
  @map.delete("a")
42
- @map["a"].should eql(@container.new)
42
+ expect(@map["a"]).to eql(@container.new)
43
43
  end
44
44
 
45
45
  it "should delete single value at key" do
46
46
  @map.delete("b", 200)
47
- @map["b"].should eql(@container.new([300]))
47
+ expect(@map["b"]).to eql(@container.new([300]))
48
48
  end
49
49
 
50
50
  it "should delete if key condition is matched" do
51
- @map.delete_if { |key, value| key >= "b" }.should eql(@map)
52
- @map["a"].should eql(@container.new([100]))
53
- @map["b"].should eql(@container.new)
51
+ expect(@map.delete_if { |key, value| key >= "b" }).to eql(@map)
52
+ expect(@map["a"]).to eql(@container.new([100]))
53
+ expect(@map["b"]).to eql(@container.new)
54
54
 
55
- @map.delete_if { |key, value| key > "z" }.should eql(@map)
55
+ expect(@map.delete_if { |key, value| key > "z" }).to eql(@map)
56
56
  end
57
57
 
58
58
  it "should delete if value condition is matched" do
59
- @map.delete_if { |key, value| value >= 300 }.should eql(@map)
60
- @map["a"].should eql(@container.new([100]))
61
- @map["b"].should eql(@container.new([200]))
59
+ expect(@map.delete_if { |key, value| value >= 300 }).to eql(@map)
60
+ expect(@map["a"]).to eql(@container.new([100]))
61
+ expect(@map["b"]).to eql(@container.new([200]))
62
62
  end
63
63
 
64
64
  it "should duplicate the containers" do
65
65
  map2 = @map.dup
66
- map2.should_not equal(@map)
67
- map2.should eql(@map)
68
- map2["a"].should_not equal(@map["a"])
69
- map2["b"].should_not equal(@map["b"])
70
- map2.default.should_not equal(@map.default)
71
- map2.default.should eql(@map.default)
66
+ expect(map2).to_not equal(@map)
67
+ expect(map2).to eql(@map)
68
+ expect(map2["a"]).to_not equal(@map["a"])
69
+ expect(map2["b"]).to_not equal(@map["b"])
70
+ expect(map2.default).to_not equal(@map.default)
71
+ expect(map2.default).to eql(@map.default)
72
72
  end
73
73
 
74
74
  it "should freeze containers" do
75
75
  @map.freeze
76
- @map.should be_frozen
77
- @map["a"].should be_frozen
78
- @map["b"].should be_frozen
76
+ expect(@map).to be_frozen
77
+ expect(@map["a"]).to be_frozen
78
+ expect(@map["b"]).to be_frozen
79
79
  end
80
80
 
81
81
  it "should iterate over each key/value pair and yield an array" do
82
82
  a = []
83
83
  @map.each { |pair| a << pair }
84
- a.should sorted_eql([["a", 100], ["b", 200], ["b", 300]])
84
+ expect(a).to sorted_eql([["a", 100], ["b", 200], ["b", 300]])
85
85
  end
86
86
 
87
87
  it "should iterate over each container" do
88
88
  a = []
89
89
  @map.each_container { |container| a << container }
90
- a.should sorted_eql([@container.new([100]), @container.new([200, 300])])
90
+ expect(a).to sorted_eql([@container.new([100]), @container.new([200, 300])])
91
91
  end
92
92
 
93
93
  it "should iterate over each key/container" do
94
94
  a = []
95
95
  @map.each_association { |key, container| a << [key, container] }
96
- a.should sorted_eql([["a", @container.new([100])], ["b", @container.new([200, 300])]])
96
+ expect(a).to sorted_eql([["a", @container.new([100])], ["b", @container.new([200, 300])]])
97
97
  end
98
98
 
99
99
  it "should iterate over each key" do
100
100
  a = []
101
101
  @map.each_key { |key| a << key }
102
- a.should sorted_eql(["a", "b", "b"])
102
+ expect(a).to sorted_eql(["a", "b", "b"])
103
103
  end
104
104
 
105
105
  it "should iterate over each key/value pair and yield the pair" do
106
106
  h = {}
107
107
  @map.each_pair { |key, value| (h[key] ||= []) << value }
108
- h.should eql({ "a" => [100], "b" => [200, 300] })
108
+ expect(h).to eql({ "a" => [100], "b" => [200, 300] })
109
109
  end
110
110
 
111
111
  it "should iterate over each value" do
112
112
  a = []
113
113
  @map.each_value { |value| a << value }
114
- a.should sorted_eql([100, 200, 300])
114
+ expect(a).to sorted_eql([100, 200, 300])
115
115
  end
116
116
 
117
117
  it "should be empty if there are no key/value pairs" do
118
118
  @map.clear
119
- @map.should be_empty
119
+ expect(@map).to be_empty
120
120
  end
121
121
 
122
122
  it "should not be empty if there are any key/value pairs" do
123
- @map.should_not be_empty
123
+ expect(@map).to_not be_empty
124
124
  end
125
125
 
126
126
  it "should fetch container of values for key" do
127
- @map.fetch("a").should eql(@container.new([100]))
128
- @map.fetch("b").should eql(@container.new([200, 300]))
129
- lambda { @map.fetch("z") }.should raise_error(IndexError)
127
+ expect(@map.fetch("a")).to eql(@container.new([100]))
128
+ expect(@map.fetch("b")).to eql(@container.new([200, 300]))
129
+ expect(lambda { @map.fetch("z") }).to raise_error(IndexError)
130
130
  end
131
131
 
132
132
  it "should check if key is present" do
133
- @map.has_key?("a").should be_true
134
- @map.key?("a").should be_true
135
- @map.has_key?("z").should be_false
136
- @map.key?("z").should be_false
133
+ expect(@map.has_key?("a")).to be_true
134
+ expect(@map.key?("a")).to be_true
135
+ expect(@map.has_key?("z")).to be_false
136
+ expect(@map.key?("z")).to be_false
137
137
  end
138
138
 
139
139
  it "should check containers when looking up by value" do
140
- @map.has_value?(100).should be_true
141
- @map.value?(100).should be_true
142
- @map.has_value?(999).should be_false
143
- @map.value?(999).should be_false
140
+ expect(@map.has_value?(100)).to be_true
141
+ expect(@map.value?(100)).to be_true
142
+ expect(@map.has_value?(999)).to be_false
143
+ expect(@map.value?(999)).to be_false
144
144
  end
145
145
 
146
146
  it "it should return the index for value" do
147
147
  if @map.respond_to?(:index)
148
- @map.index(200).should eql(@container.new(["b"]))
149
- @map.index(999).should eql(@container.new)
148
+ expect(@map.index(200)).to eql(@container.new(["b"]))
149
+ expect(@map.index(999)).to eql(@container.new)
150
150
  end
151
151
  end
152
152
 
153
153
  it "should replace the contents of hash" do
154
154
  @map.replace({ "c" => @container.new([300]), "d" => @container.new([400]) })
155
- @map["a"].should eql(@container.new)
156
- @map["c"].should eql(@container.new([300]))
155
+ expect(@map["a"]).to eql(@container.new)
156
+ expect(@map["c"]).to eql(@container.new([300]))
157
157
  end
158
158
 
159
159
  it "should return an inverted Multimap" do
@@ -162,103 +162,103 @@ shared_examples_for Hash, Multimap, "with inital values {'a' => [100], 'b' => [2
162
162
  map2[100] = "a"
163
163
  map2[200] = "b"
164
164
  map2[300] = "b"
165
- @map.invert.should eql(map2)
165
+ expect(@map.invert).to eql(map2)
166
166
  end
167
167
  end
168
168
 
169
169
  it "should return array of keys" do
170
- @map.keys.should eql(["a", "b", "b"])
170
+ expect(@map.keys).to eql(["a", "b", "b"])
171
171
  end
172
172
 
173
173
  it "should return the number of key/value pairs" do
174
- @map.length.should eql(3)
175
- @map.size.should eql(3)
174
+ expect(@map.length).to eql(3)
175
+ expect(@map.size).to eql(3)
176
176
  end
177
177
 
178
178
  it "should duplicate map and with merged values" do
179
179
  map = @map.merge("b" => 254, "c" => @container.new([300]))
180
- map["a"].should eql(@container.new([100]))
181
- map["b"].should eql(@container.new([200, 300, 254]))
182
- map["c"].should eql(@container.new([300]))
180
+ expect(map["a"]).to eql(@container.new([100]))
181
+ expect(map["b"]).to eql(@container.new([200, 300, 254]))
182
+ expect(map["c"]).to eql(@container.new([300]))
183
183
 
184
- @map["a"].should eql(@container.new([100]))
185
- @map["b"].should eql(@container.new([200, 300]))
186
- @map["c"].should eql(@container.new)
184
+ expect(@map["a"]).to eql(@container.new([100]))
185
+ expect(@map["b"]).to eql(@container.new([200, 300]))
186
+ expect(@map["c"]).to eql(@container.new)
187
187
  end
188
188
 
189
189
  it "should update map" do
190
190
  @map.update("b" => 254, "c" => @container.new([300]))
191
- @map["a"].should eql(@container.new([100]))
192
- @map["b"].should eql(@container.new([200, 300, 254]))
193
- @map["c"].should eql(@container.new([300]))
191
+ expect(@map["a"]).to eql(@container.new([100]))
192
+ expect(@map["b"]).to eql(@container.new([200, 300, 254]))
193
+ expect(@map["c"]).to eql(@container.new([300]))
194
194
 
195
195
  klass = @map.class
196
196
  @map.update(klass[@container.new, {"a" => @container.new([400, 500]), "c" => 600}])
197
- @map["a"].should eql(@container.new([100, 400, 500]))
198
- @map["b"].should eql(@container.new([200, 300, 254]))
199
- @map["c"].should eql(@container.new([300, 600]))
197
+ expect(@map["a"]).to eql(@container.new([100, 400, 500]))
198
+ expect(@map["b"]).to eql(@container.new([200, 300, 254]))
199
+ expect(@map["c"]).to eql(@container.new([300, 600]))
200
200
  end
201
201
 
202
202
  it "should reject key pairs on copy of the map" do
203
203
  map = @map.reject { |key, value| key >= "b" }
204
- map["b"].should eql(@container.new)
205
- @map["b"].should eql(@container.new([200, 300]))
204
+ expect(map["b"]).to eql(@container.new)
205
+ expect(@map["b"]).to eql(@container.new([200, 300]))
206
206
  end
207
207
 
208
208
  it "should reject value pairs on copy of the map" do
209
209
  map = @map.reject { |key, value| value >= 300 }
210
- map["b"].should eql(@container.new([200]))
211
- @map["b"].should eql(@container.new([200, 300]))
210
+ expect(map["b"]).to eql(@container.new([200]))
211
+ expect(@map["b"]).to eql(@container.new([200, 300]))
212
212
  end
213
213
 
214
214
  it "should reject key pairs" do
215
- @map.reject! { |key, value| key >= "b" }.should eql(@map)
216
- @map["a"].should eql(@container.new([100]))
217
- @map["b"].should eql(@container.new)
215
+ expect(@map.reject! { |key, value| key >= "b" }).to eql(@map)
216
+ expect(@map["a"]).to eql(@container.new([100]))
217
+ expect(@map["b"]).to eql(@container.new)
218
218
 
219
- @map.reject! { |key, value| key >= "z" }.should eql(nil)
219
+ expect(@map.reject! { |key, value| key >= "z" }).to eql(nil)
220
220
  end
221
221
 
222
222
  it "should reject value pairs" do
223
- @map.reject! { |key, value| value >= 300 }.should eql(@map)
224
- @map["a"].should eql(@container.new([100]))
225
- @map["b"].should eql(@container.new([200]))
223
+ expect(@map.reject! { |key, value| value >= 300 }).to eql(@map)
224
+ expect(@map["a"]).to eql(@container.new([100]))
225
+ expect(@map["b"]).to eql(@container.new([200]))
226
226
 
227
- @map.reject! { |key, value| key >= "z" }.should eql(nil)
227
+ expect(@map.reject! { |key, value| key >= "z" }).to eql(nil)
228
228
  end
229
229
 
230
230
  it "should select key/value pairs" do
231
- @map.select { |k, v| k > "a" }.should eql(Multimap["b", [200, 300]])
232
- @map.select { |k, v| v < 200 }.should eql(Multimap["a", 100])
231
+ expect(@map.select { |k, v| k > "a" }).to eql(Multimap["b", [200, 300]])
232
+ expect(@map.select { |k, v| v < 200 }).to eql(Multimap["a", 100])
233
233
  end
234
234
 
235
235
  it "should convert to hash" do
236
- @map.to_hash["a"].should eql(@container.new([100]))
237
- @map.to_hash["b"].should eql(@container.new([200, 300]))
238
- @map.to_hash.should_not equal(@map)
236
+ expect(@map.to_hash["a"]).to eql(@container.new([100]))
237
+ expect(@map.to_hash["b"]).to eql(@container.new([200, 300]))
238
+ expect(@map.to_hash).to_not equal(@map)
239
239
  end
240
240
 
241
241
  it "should return all containers" do
242
- @map.containers.should sorted_eql([@container.new([100]), @container.new([200, 300])])
242
+ expect(@map.containers).to sorted_eql([@container.new([100]), @container.new([200, 300])])
243
243
  end
244
244
 
245
245
  it "should return all values" do
246
- @map.values.should sorted_eql([100, 200, 300])
246
+ expect(@map.values).to sorted_eql([100, 200, 300])
247
247
  end
248
248
 
249
249
  it "should return return values at keys" do
250
- @map.values_at("a", "b").should eql([@container.new([100]), @container.new([200, 300])])
250
+ expect(@map.values_at("a", "b")).to eql([@container.new([100]), @container.new([200, 300])])
251
251
  end
252
252
 
253
253
  it "should marshal hash" do
254
254
  data = Marshal.dump(@map)
255
- Marshal.load(data).should eql(@map)
255
+ expect(Marshal.load(data)).to eql(@map)
256
256
  end
257
257
 
258
258
  it "should dump yaml" do
259
259
  require 'yaml'
260
260
 
261
261
  data = YAML.dump(@map)
262
- YAML.load(data).should eql(@map)
262
+ expect(YAML.load(data)).to eql(@map)
263
263
  end
264
264
  end