cucumber-mailcatcher 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/mailcatcher/http_client.rb +4 -3
- data/lib/cucumber/mailcatcher/version.rb +1 -1
- data/lib/cucumber/mailcatcher.rb +10 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f302cf4686dd159d158da718fc421d3eb7ee05a
|
4
|
+
data.tar.gz: 5923b1530c63fe0c9264e154415628f91a49a2aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 115b99aef3eea27156021cbaf9a2e60534b76622a03fc98d3224e8851e21d7b090dd6ffc0c98e801732440b5375c4d236196b16300724d2b53ef4ea0e44e0417
|
7
|
+
data.tar.gz: a90851ab6c87eb8262d9642b714fad95c75f7bdf0a7c13e7de580a071de14eb41f9b042b19f7da161c6751f7752ef4fdf9b22636ed872d1d5612e4fc80cb7a01
|
@@ -7,6 +7,8 @@ module Cucumber
|
|
7
7
|
module Mailcatcher
|
8
8
|
|
9
9
|
class HttpClient
|
10
|
+
@@server_url = nil
|
11
|
+
|
10
12
|
def self.server_url
|
11
13
|
@@server_url
|
12
14
|
end
|
@@ -17,9 +19,8 @@ module Cucumber
|
|
17
19
|
|
18
20
|
def initialize
|
19
21
|
error = "Please set the Mailcatcher server url e.g. Cucumber::Mailcatcher::Api.server_url = 'http://localhost:1080'"
|
20
|
-
|
21
|
-
|
22
|
-
end
|
22
|
+
|
23
|
+
valid = @@server_url =~ /\A#{URI.regexp(%w(http https))}\z/
|
23
24
|
|
24
25
|
raise error unless valid
|
25
26
|
end
|
data/lib/cucumber/mailcatcher.rb
CHANGED
@@ -8,31 +8,31 @@ require 'cucumber/mailcatcher/http_client.rb'
|
|
8
8
|
require 'cucumber/mailcatcher/version.rb'
|
9
9
|
|
10
10
|
Then /^I should receive (\d+) email from "(.*?)"$/ do |count, address|
|
11
|
-
|
12
|
-
messages =
|
11
|
+
api = Cucumber::Mailcatcher::Api.new Cucumber::Mailcatcher::HttpClient.new
|
12
|
+
messages = api.get_messages_from_email address
|
13
13
|
expect(messages.length).to be count.to_i
|
14
14
|
end
|
15
15
|
|
16
16
|
Then /^I should receive (\d+) email sent to "(.*?)"$/ do |count, address|
|
17
|
-
|
18
|
-
messages =
|
17
|
+
api = Cucumber::Mailcatcher::Api.new Cucumber::Mailcatcher::HttpClient.new
|
18
|
+
messages = api.get_messages_to_email address
|
19
19
|
expect(messages.length).to be count.to_i
|
20
20
|
end
|
21
21
|
|
22
22
|
Then /^I should receive (\d+) email with subject "(.*?)"$/ do |count, subject|
|
23
|
-
|
24
|
-
messages =
|
23
|
+
api = Cucumber::Mailcatcher::Api.new Cucumber::Mailcatcher::HttpClient.new
|
24
|
+
messages = api.get_messages_with_subject subject
|
25
25
|
expect(messages.length).to be count.to_i
|
26
26
|
end
|
27
27
|
|
28
28
|
Then /^I should receive (\d+) email with a html body containing "(.*?)"$/ do |count, body|
|
29
|
-
|
30
|
-
messages =
|
29
|
+
api = Cucumber::Mailcatcher::Api.new Cucumber::Mailcatcher::HttpClient.new
|
30
|
+
messages = api.get_messages_with_html_body body
|
31
31
|
expect(messages.length).to be count.to_i
|
32
32
|
end
|
33
33
|
|
34
34
|
Then /^I should receive (\d+) email with a plain body containing "(.*?)"$/ do |count, body|
|
35
|
-
|
36
|
-
messages =
|
35
|
+
api = Cucumber::Mailcatcher::Api.new Cucumber::Mailcatcher::HttpClient.new
|
36
|
+
messages = api.get_messages_with_plain_body body
|
37
37
|
expect(messages.length).to be count.to_i
|
38
38
|
end
|