anadea-mailsocio-qa 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mailsocio_qa/mailsocio_test.rb +10 -6
- data/lib/mailsocio_qa/settings.rb +0 -2
- data/lib/mailsocio_qa/test_client.rb +11 -6
- data/lib/minitest/mailsocio_qa_plugin.rb +0 -11
- data/mailsocio-qa.gemspec +1 -1
- 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: 44aa673899ca7512089779b18172d6c44bd26b2e
|
4
|
+
data.tar.gz: b21008d6fe3b61092438cd9e2daac18001b978fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5b28b492fae50a4832d275d0bc3ccb13b9778226fe44cdc40cb7e825100da6ade93c579026a7d3f783a20d02fd9dc604fea459fdf0196ccf030dfb722f5c6f
|
7
|
+
data.tar.gz: c1ab22ef6962d39e6f641e79be374521c644fcfab20ebf1c8d815b23e369e2e31842a8cea6fa6718bb2b38af64c86209f7c97496212e5b5f42d24cb923366f66
|
data/Gemfile.lock
CHANGED
@@ -6,12 +6,16 @@ require 'mailsocio_qa/test_html_page'
|
|
6
6
|
|
7
7
|
module MailsocioQA
|
8
8
|
class MailsocioTest < ::Minitest::Test
|
9
|
+
def settings
|
10
|
+
@settings ||= Settings.new(ENV.fetch("CONFIG_FILE", File.expand_path('../../../settings.yml', __FILE__)))
|
11
|
+
end
|
12
|
+
|
9
13
|
def setup
|
10
|
-
@base_domain = Regexp.escape(
|
11
|
-
@track_domain = "track.#{
|
12
|
-
@client = TestClient.new
|
14
|
+
@base_domain = Regexp.escape(settings.mailsocio.base_domain)
|
15
|
+
@track_domain = "track.#{settings.mailsocio.base_domain}"
|
16
|
+
@client = TestClient.new(settings)
|
13
17
|
|
14
|
-
addresses =
|
18
|
+
addresses = settings.trap.addresses
|
15
19
|
@john = addresses.john
|
16
20
|
@jane = addresses.jane
|
17
21
|
@invalid = addresses.invalid
|
@@ -204,7 +208,7 @@ NONASCIIHTML
|
|
204
208
|
end
|
205
209
|
|
206
210
|
def test_custom_tracking_domain
|
207
|
-
domain =
|
211
|
+
domain = settings.trap.custom_tracking_domain
|
208
212
|
attrs = @client.create_account(custom_tracking_domain: domain)
|
209
213
|
@client.custom_tracking_domain = domain
|
210
214
|
assert_wont_raise('Could not read account via custom tracking domain URL') do
|
@@ -226,7 +230,7 @@ NONASCIIHTML
|
|
226
230
|
end
|
227
231
|
|
228
232
|
def test_custom_tracking_hard_bounce
|
229
|
-
domain =
|
233
|
+
domain = settings.trap.custom_tracking_domain
|
230
234
|
@client.create_account(custom_tracking_domain: domain)
|
231
235
|
|
232
236
|
@client.clean_messages
|
@@ -3,9 +3,14 @@ require 'mailsocio_qa/settings'
|
|
3
3
|
module MailsocioQA
|
4
4
|
class TestClient
|
5
5
|
attr_accessor :account_id, :custom_tracking_domain
|
6
|
+
attr_accessor :settings
|
7
|
+
|
8
|
+
def initialize(settings)
|
9
|
+
self.settings = settings
|
10
|
+
end
|
6
11
|
|
7
12
|
def create_account(attrs = {})
|
8
|
-
attrs.reverse_merge!(api_key:
|
13
|
+
attrs.reverse_merge!(api_key: settings.mailsocio.api_key)
|
9
14
|
response = HTTPI.post(accounts_url, { account: attrs}.to_query)
|
10
15
|
raise "Could not create account:\n#{response.body}" if response.error?
|
11
16
|
|
@@ -29,10 +34,10 @@ module MailsocioQA
|
|
29
34
|
end
|
30
35
|
|
31
36
|
def deliver(fields = {}, &block)
|
32
|
-
config =
|
37
|
+
config = settings.mailsocio.mail
|
33
38
|
fields.reverse_merge!(
|
34
39
|
'X-Account-Id' => account_id,
|
35
|
-
'X-Api-Key' =>
|
40
|
+
'X-Api-Key' => settings.mailsocio.api_key
|
36
41
|
)
|
37
42
|
fields.reverse_merge!(config.message)
|
38
43
|
|
@@ -60,8 +65,8 @@ module MailsocioQA
|
|
60
65
|
end
|
61
66
|
|
62
67
|
def retriever(user)
|
63
|
-
address =
|
64
|
-
server =
|
68
|
+
address = settings.trap.addresses[user]
|
69
|
+
server = settings.trap.server
|
65
70
|
settings = server.settings.symbolize_keys
|
66
71
|
settings.merge!(user_name: address)
|
67
72
|
|
@@ -82,7 +87,7 @@ module MailsocioQA
|
|
82
87
|
|
83
88
|
def app_url(path)
|
84
89
|
if custom_tracking_domain.blank?
|
85
|
-
"http://app.#{
|
90
|
+
"http://app.#{settings.mailsocio.base_domain}#{path}"
|
86
91
|
else
|
87
92
|
"http://#{self.custom_tracking_domain}#{path}"
|
88
93
|
end
|
@@ -1,15 +1,4 @@
|
|
1
|
-
require 'mailsocio_qa/settings'
|
2
|
-
|
3
1
|
module Minitest
|
4
|
-
def self.plugin_mailsocio_qa_options(opts, options)
|
5
|
-
opts.on "-c", "--config PATH", String, "Mailsocio QA config file." do |source|
|
6
|
-
MailsocioQA::Settings.source source
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.plugin_mailsocio_qa_init(options)
|
11
|
-
end
|
12
|
-
|
13
2
|
class Test
|
14
3
|
def self.runnable_methods
|
15
4
|
methods_matching(/^test_/)
|
data/mailsocio-qa.gemspec
CHANGED