anadea-mailsocio-qa 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd8669cc134b3ab41940fbb0c66f58559b2bfe07
4
- data.tar.gz: f2e2b649bc514d0fc986d3d4d1f59556784fbea3
3
+ metadata.gz: 44aa673899ca7512089779b18172d6c44bd26b2e
4
+ data.tar.gz: b21008d6fe3b61092438cd9e2daac18001b978fa
5
5
  SHA512:
6
- metadata.gz: 20fd8c635cc2f6e76672b4150de5f019ed416d877a70eec6f02dfb4b0ebde95eeaab13487d39c04ee18b6cc82ee0d0ea5b5518d58b29cd8888adfb9da62d8485
7
- data.tar.gz: bab4085580ddda0f413604cd38b97649df92977b64d9de757e4639142e96ccf549b8bdd95174bf63b986fb382d68957a78ea4445169dc7791069e5147079ff8c
6
+ metadata.gz: aa5b28b492fae50a4832d275d0bc3ccb13b9778226fe44cdc40cb7e825100da6ade93c579026a7d3f783a20d02fd9dc604fea459fdf0196ccf030dfb722f5c6f
7
+ data.tar.gz: c1ab22ef6962d39e6f641e79be374521c644fcfab20ebf1c8d815b23e369e2e31842a8cea6fa6718bb2b38af64c86209f7c97496212e5b5f42d24cb923366f66
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- anadea-mailsocio-qa (0.0.3)
4
+ anadea-mailsocio-qa (0.1.2)
5
5
  activesupport (>= 3.0, < 5.0)
6
6
  httpi (>= 2.0)
7
7
  json (>= 1.0)
@@ -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(Settings.mailsocio.base_domain)
11
- @track_domain = "track.#{Settings.mailsocio.base_domain}"
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 = Settings.trap.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 = Settings.trap.custom_tracking_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 = Settings.trap.custom_tracking_domain
233
+ domain = settings.trap.custom_tracking_domain
230
234
  @client.create_account(custom_tracking_domain: domain)
231
235
 
232
236
  @client.clean_messages
@@ -1,7 +1,5 @@
1
1
  require 'settingslogic'
2
2
  module MailsocioQA
3
3
  class Settings < Settingslogic
4
- source File.expand_path('../../../settings.yml', __FILE__)
5
- load!
6
4
  end
7
5
  end
@@ -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: Settings.mailsocio.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 = Settings.mailsocio.mail
37
+ config = settings.mailsocio.mail
33
38
  fields.reverse_merge!(
34
39
  'X-Account-Id' => account_id,
35
- 'X-Api-Key' => Settings.mailsocio.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 = Settings.trap.addresses[user]
64
- server = Settings.trap.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.#{Settings.mailsocio.base_domain}#{path}"
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'anadea-mailsocio-qa'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "Mailsocio Quality Assurance"
6
6
  s.description = s.summary
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anadea-mailsocio-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anadea