mailhandler 1.0.61 → 1.0.70

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de40ee0be87a056910ae5518108c764c7eb9ac8c3966bf493785fffc91e7cb5b
4
- data.tar.gz: 021c325cb06ded1e127b2eda02ab4aacd01dc39be42b0f2a43b65354d505742f
3
+ metadata.gz: dbb6f095a2ff9b3b0ab32cee4f24945b5fe9e6a94ea250c73e385166d6cc1136
4
+ data.tar.gz: fde7cbaf06445b3851eb6aae43187dd1da44ee2ff75d0e1162ad0f2f638f991e
5
5
  SHA512:
6
- metadata.gz: ceef3cf4ad8ae793e321999dfe4b4ee7e9e4eb3334baf7de3d98b89990228b64984a553566c66fe5f3eefe981422e776382ab54d4a95e7e7ba7594f33a2020e4
7
- data.tar.gz: 0ceca108ee81c36e280d24b5580860ab156bfda4c807b7a25addfb9cb2939e45b3b5234c0d4f3ac0fe099699959e1b4e10c22f450b5f6eee63aac573bfadc351
6
+ metadata.gz: bc2775e3ab6dfeba7b8ee4e7c87f20433be4b26ee9ce23c88929a389ac4b5eed4de231f8c2ad207429d865242d286386b100fe19dd7b632489010787582d3e00
7
+ data.tar.gz: b9b8dcf8164a9ab0c8d6c4ad700b67912bd4af30b4497716b362ccb6bf42fc299a30cfaaeb2433dd9e42ec5aeb7c6f3929b2df63ca46873c9e2a3f321a954159
data/.circleci/config.yml CHANGED
@@ -4,23 +4,18 @@ workflows:
4
4
  ruby-tests:
5
5
  jobs:
6
6
  - unit-tests:
7
- name: ruby24
8
- version: "2.4.6"
9
- - unit-tests:
10
- name: ruby25
11
- version: "2.5.5"
12
- requires:
13
- - ruby24
7
+ name: ruby30
8
+ version: "3.0.0"
14
9
  - unit-tests:
15
- name: ruby27
16
- version: "2.7.5"
10
+ name: ruby31
11
+ version: "3.1.0"
17
12
  requires:
18
- - ruby25
13
+ - ruby30
19
14
  - unit-tests:
20
- name: ruby30
21
- version: "3.0.0"
15
+ name: ruby322
16
+ version: "3.2.2"
22
17
  requires:
23
- - ruby27
18
+ - ruby31
24
19
 
25
20
  jobs:
26
21
  unit-tests:
data/.gitignore CHANGED
@@ -2,6 +2,5 @@
2
2
  **/*.rvm
3
3
  **/*.DS_Store
4
4
  **/*.idea
5
- Gemfile.lock
6
5
  *.gem
7
6
 
data/.rubocop.yml CHANGED
@@ -1,26 +1,156 @@
1
- require: rubocop-rspec
1
+ require:
2
+ - rubocop-rspec
2
3
 
3
- # increase line length since we are checking test files
4
- Metrics/LineLength:
4
+ AllCops:
5
+ TargetRubyVersion: 3.0
6
+ NewCops: enable
7
+ Exclude:
8
+ - 'temp/**/*'
9
+
10
+ # Line length is increased, since we are checking mostly selenium test files,
11
+ # which easily get longer and are still readable.
12
+ Layout/LineLength:
5
13
  Max: 120
6
14
 
7
- Metrics/MethodLength:
8
- Max: 15
15
+ # Block length is increased, since we are checking mostly selenium test files,
16
+ # which easily get longer and are still readable.
17
+ Metrics/BlockLength:
18
+ Max: 700
9
19
 
10
20
  Metrics/ClassLength:
11
- Max: 120
21
+ Max: 250
22
+
23
+ Metrics/ModuleLength:
24
+ Max: 150
12
25
 
26
+ # Describe class error is ignored since most of the tests in this suite will not test code,
27
+ # but rather UI functionality.
28
+ RSpec/DescribeClass:
29
+ Exclude:
30
+ - '**/*'
31
+
32
+ # Context wording is ignored since we test UI functionality not code.
13
33
  RSpec/ContextWording:
14
- Enabled: false
34
+ Exclude:
35
+ - '**/*'
36
+
37
+ # We want to preserve labels for before/after blocks.
38
+ RSpec/BeforeAfterAll:
39
+ Exclude:
40
+ - '**/*'
15
41
 
42
+ # We want to preserve labels for before/after blocks.
43
+ RSpec/HookArgument:
44
+ Exclude:
45
+ - '**/*'
46
+
47
+ # Maximum nested group is increased for allowing more context separation between tests.
16
48
  RSpec/NestedGroups:
17
- Max: 7
49
+ Max: 6
18
50
 
19
- Metrics/BlockLength:
20
- Max: 200
51
+ # Example length is increased due lot's of UI actions needed to be executed during test run.
52
+ # These increase test length significantly.
53
+ RSpec/ExampleLength:
54
+ Max: 60
55
+
56
+ # Method length is increased due lot's of UI actions needed to be executed during test run.
57
+ # These increase test length significantly.
58
+ Metrics/MethodLength:
59
+ Max: 15
60
+
61
+ # In some cases we must use instance variable, to pass state through the tests at the beginning and end of testing.
62
+ RSpec/InstanceVariable:
63
+ Enabled: false
64
+
65
+ # Multiple expectations are allowed for now to speed up test execution.
66
+ RSpec/MultipleExpectations:
67
+ Enabled: false
68
+
69
+ RSpec/PendingWithoutReason:
70
+ Enabled: false
21
71
 
22
72
  RSpec/FilePath:
23
73
  Enabled: false
24
74
 
25
- RSpec/ExampleLength:
26
- Max: 10
75
+ RSpec/SpecFilePathFormat:
76
+ Enabled: false
77
+
78
+ # Selenium pageobjects are excluded from class documentation since they are self explanatory.
79
+ Style/Documentation:
80
+ Exclude:
81
+ - 'spec/support/pageobjects/**/*'
82
+
83
+ # Allow unicode in comments
84
+ Style/AsciiComments:
85
+ Enabled: false
86
+
87
+ Style/HashEachMethods:
88
+ Enabled: true
89
+
90
+ Style/HashTransformKeys:
91
+ Enabled: true
92
+
93
+ Style/HashTransformValues:
94
+ Enabled: true
95
+
96
+ Style/FormatStringToken:
97
+ Enabled: false
98
+
99
+ Style/NumericPredicate:
100
+ Enabled: false
101
+
102
+ Layout/SpaceAroundMethodCallOperator:
103
+ Enabled: true
104
+
105
+ Lint/RaiseException:
106
+ Enabled: true
107
+
108
+ Lint/StructNewOverride:
109
+ Enabled: true
110
+
111
+ Style/ExponentialNotation:
112
+ Enabled: true
113
+
114
+ Layout/EmptyLinesAroundAttributeAccessor:
115
+ Enabled: true
116
+
117
+ Lint/DeprecatedOpenSSLConstant:
118
+ Enabled: true
119
+
120
+ Style/SlicingWithRange:
121
+ Enabled: true
122
+
123
+
124
+ # New rubocops
125
+ Lint/DuplicateElsifCondition:
126
+ Enabled: true
127
+ Lint/MixedRegexpCaptureTypes:
128
+ Enabled: true
129
+ Style/AccessorGrouping:
130
+ Enabled: true
131
+ Style/ArrayCoercion:
132
+ Enabled: true
133
+ Style/BisectedAttrAccessor:
134
+ Enabled: true
135
+ Style/CaseLikeIf:
136
+ Enabled: true
137
+ Style/HashAsLastArrayItem:
138
+ Enabled: true
139
+ Style/HashLikeCase:
140
+ Enabled: true
141
+ Style/RedundantAssignment:
142
+ Enabled: true
143
+ Style/RedundantFetchBlock:
144
+ Enabled: true
145
+ Style/RedundantFileExtensionInRequire:
146
+ Enabled: true
147
+ Style/RedundantRegexpCharacterClass:
148
+ Enabled: true
149
+ Style/RedundantRegexpEscape:
150
+ Enabled: true
151
+
152
+ RSpec/MultipleMemoizedHelpers:
153
+ Max: 20
154
+
155
+ Style/OptionalBooleanParameter:
156
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ mailhandler
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.2.2
data/Gemfile CHANGED
@@ -8,4 +8,3 @@ gem 'postmark'
8
8
  gem 'pry'
9
9
  gem 'rspec'
10
10
  gem 'rubocop'
11
- gem 'rubocop-rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,93 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.4.2)
5
+ coderay (1.1.3)
6
+ date (3.3.4)
7
+ diff-lcs (1.5.0)
8
+ json (2.7.1)
9
+ language_server-protocol (3.17.0.3)
10
+ mail (2.8.1)
11
+ mini_mime (>= 0.1.1)
12
+ net-imap
13
+ net-pop
14
+ net-smtp
15
+ method_source (1.0.0)
16
+ mini_mime (1.1.5)
17
+ net-imap (0.4.9)
18
+ date
19
+ net-protocol
20
+ net-pop (0.1.2)
21
+ net-protocol
22
+ net-protocol (0.2.2)
23
+ timeout
24
+ net-smtp (0.4.0)
25
+ net-protocol
26
+ parallel (1.24.0)
27
+ parser (3.2.2.4)
28
+ ast (~> 2.4.1)
29
+ racc
30
+ postmark (1.25.0)
31
+ json
32
+ pry (0.14.2)
33
+ coderay (~> 1.1)
34
+ method_source (~> 1.0)
35
+ racc (1.7.3)
36
+ rainbow (3.1.1)
37
+ regexp_parser (2.8.3)
38
+ rexml (3.2.6)
39
+ rspec (3.12.0)
40
+ rspec-core (~> 3.12.0)
41
+ rspec-expectations (~> 3.12.0)
42
+ rspec-mocks (~> 3.12.0)
43
+ rspec-core (3.12.2)
44
+ rspec-support (~> 3.12.0)
45
+ rspec-expectations (3.12.3)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.12.0)
48
+ rspec-mocks (3.12.6)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.12.0)
51
+ rspec-support (3.12.1)
52
+ rubocop (1.59.0)
53
+ json (~> 2.3)
54
+ language_server-protocol (>= 3.17.0)
55
+ parallel (~> 1.10)
56
+ parser (>= 3.2.2.4)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ regexp_parser (>= 1.8, < 3.0)
59
+ rexml (>= 3.2.5, < 4.0)
60
+ rubocop-ast (>= 1.30.0, < 2.0)
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 2.4.0, < 3.0)
63
+ rubocop-ast (1.30.0)
64
+ parser (>= 3.2.1.0)
65
+ rubocop-capybara (2.19.0)
66
+ rubocop (~> 1.41)
67
+ rubocop-factory_bot (2.24.0)
68
+ rubocop (~> 1.33)
69
+ rubocop-performance (1.20.1)
70
+ rubocop (>= 1.48.1, < 2.0)
71
+ rubocop-ast (>= 1.30.0, < 2.0)
72
+ rubocop-rspec (2.25.0)
73
+ rubocop (~> 1.40)
74
+ rubocop-capybara (~> 2.17)
75
+ rubocop-factory_bot (~> 2.22)
76
+ ruby-progressbar (1.13.0)
77
+ timeout (0.4.1)
78
+ unicode-display_width (2.5.0)
79
+
80
+ PLATFORMS
81
+ ruby
82
+
83
+ DEPENDENCIES
84
+ mail
85
+ postmark
86
+ pry
87
+ rspec
88
+ rubocop
89
+ rubocop-performance
90
+ rubocop-rspec
91
+
92
+ BUNDLED WITH
93
+ 2.5.3
@@ -76,11 +76,8 @@ module Mail
76
76
 
77
77
  def retrieve_email_content(uid, flag_type = :body)
78
78
  case flag_type
79
- when :body
80
- retrieve_email_content_by_body(uid)
81
79
  when :envelope
82
80
  retrieve_email_content_by_envelope(uid)
83
-
84
81
  else
85
82
  retrieve_email_content_by_body(uid)
86
83
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mail
2
4
  # wrapper methods to support sending raw email, where recipient and sender can be custom
3
5
  class SMTP
@@ -90,12 +90,12 @@ module MailHandler
90
90
 
91
91
  count = options[:count]
92
92
  error_message = "Incorrect option options[:count]=#{options[:count]}."
93
- raise MailHandler::Error, error_message if (count < 0) || (count > 2000)
93
+ raise MailHandler::Error, error_message if count.negative? || (count > 2000)
94
94
  end
95
95
 
96
96
  def validate_used_options(options)
97
- error_message = "#{options.keys - available_search_options} - Incorrect search option values,"\
98
- " options are #{available_search_options}."
97
+ error_message = "#{options.keys - available_search_options} - Incorrect search option values, " \
98
+ "options are #{available_search_options}."
99
99
  raise MailHandler::Error, error_message unless (options.keys - available_search_options).empty?
100
100
  end
101
101
 
@@ -55,7 +55,7 @@ module MailHandler
55
55
  }.freeze
56
56
 
57
57
  def search_pattern
58
- @inbox_folder + '/*.*'
58
+ "#{@inbox_folder}/*.*"
59
59
  end
60
60
 
61
61
  # find files by FILE_SEARCH_CLASSES options
@@ -18,11 +18,11 @@ module MailHandler
18
18
  end
19
19
 
20
20
  def delete_observer(observer)
21
- @observers.delete(observer) if @observers
21
+ @observers&.delete(observer)
22
22
  end
23
23
 
24
24
  def notify_observers(search)
25
- @observers.each { |observer| observer.notify(search) } if @observers
25
+ @observers&.each { |observer| observer.notify(search) }
26
26
  end
27
27
  end
28
28
  end
@@ -65,7 +65,7 @@ module MailHandler
65
65
 
66
66
  def format_response(response)
67
67
  return response unless response.is_a? Hash
68
- return response if response.keys.select { |key| key.is_a? Symbol }.empty?
68
+ return response if response.keys.none? { |key| key.is_a? Symbol }
69
69
 
70
70
  response.keys.select { |key| key.is_a? String }.each { |s| response.delete(s) }
71
71
  response
@@ -11,7 +11,7 @@ module MailHandler
11
11
  :open_timeout, :read_timeout, :save_response
12
12
 
13
13
  def initialize
14
- super :smtp
14
+ super(:smtp)
15
15
 
16
16
  @authentication = 'plain'
17
17
  @use_ssl = true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailHandler
4
- VERSION = '1.0.61'
4
+ VERSION = '1.0.70'
5
5
  end
data/mailhandler.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.version = MailHandler::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.license = 'MIT'
12
+ s.required_ruby_version = '>= 3.0.0'
12
13
 
13
14
  s.authors = ['Igor Balos']
14
15
  s.email = ['ibalosh@gmail.com', 'ibalos@activecampaign.com']
@@ -17,7 +18,6 @@ Gem::Specification.new do |s|
17
18
  s.description = 'Use this gem to send emails through SMTP and Postmark API and check if email arrived.'
18
19
 
19
20
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
20
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
21
21
  s.homepage = 'https://github.com/ActiveCampaign/mailhandler'
22
22
  s.require_paths = ['lib']
23
23
 
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
 
31
31
  s.required_rubygems_version = '>= 1.9.3'
32
32
 
33
- s.add_dependency 'mail'
33
+ s.add_dependency 'mail', '>= 2.7.0'
34
34
  s.add_dependency 'postmark', '>= 1.7.0'
35
+ s.metadata['rubygems_mfa_required'] = 'true'
35
36
  end
@@ -8,20 +8,17 @@ describe MailHandler::Receiver do
8
8
 
9
9
  let(:default_search_option) { { by_subject: 'test' } }
10
10
  let(:receiving_duration) { 5 }
11
- let(:found_email) { Mail.new { subject :"test email" } }
11
+ let(:found_email) { Mail.new({ subject: 'test email' }) }
12
12
  let(:checker) do
13
- checker = instance_double('Checker')
13
+ checker = instance_double(MailHandler::Receiving::Checker)
14
14
 
15
15
  allow(checker).to receive(:find) do
16
16
  sleep receiving_duration
17
17
  true
18
18
  end
19
19
 
20
- allow(checker).to receive(:search_result).and_return(true)
21
20
  allow(checker).to receive(:found_emails) { [found_email] }
22
- allow(checker).to receive(:reset_found_emails).and_return([])
23
- allow(checker).to receive(:start).and_return(nil)
24
- allow(checker).to receive(:stop).and_return(nil)
21
+ allow(checker).to receive_messages(search_result: true, reset_found_emails: [], start: nil, stop: nil)
25
22
  checker
26
23
  end
27
24
 
@@ -38,7 +35,7 @@ describe MailHandler::Receiver do
38
35
  end
39
36
 
40
37
  it 'create' do
41
- expect(receiver).to be_kind_of described_class
38
+ expect(receiver).to be_a described_class
42
39
  end
43
40
 
44
41
  it '.find_email' do
@@ -61,14 +58,10 @@ describe MailHandler::Receiver do
61
58
 
62
59
  describe '.search not found' do
63
60
  let(:checker) do
64
- checker = instance_double('Checker')
65
-
66
- allow(checker).to receive(:find).and_return(false)
67
- allow(checker).to receive(:search_result).and_return(false)
68
- allow(checker).to receive(:found_emails).and_return([])
69
- allow(checker).to receive(:reset_found_emails).and_return([])
70
- allow(checker).to receive(:start).and_return(nil)
71
- allow(checker).to receive(:stop).and_return(nil)
61
+ checker = instance_double(MailHandler::Receiving::Checker)
62
+
63
+ allow(checker).to receive_messages(find: false, search_result: false, found_emails: [], reset_found_emails: [],
64
+ start: nil, stop: nil)
72
65
  checker
73
66
  end
74
67
 
@@ -89,17 +82,14 @@ describe MailHandler::Receiver do
89
82
 
90
83
  describe '.search' do
91
84
  let(:checker) do
92
- checker = instance_double('Checker')
85
+ checker = instance_double(MailHandler::Receiving::Checker)
93
86
 
94
87
  allow(checker).to receive(:find) do
95
88
  sleep 1
96
89
  false
97
90
  end
98
- allow(checker).to receive(:search_result).and_return(true)
99
- allow(checker).to receive(:found_emails).and_return([])
100
- allow(checker).to receive(:reset_found_emails).and_return([])
101
- allow(checker).to receive(:start).and_return(nil)
102
- allow(checker).to receive(:stop).and_return(nil)
91
+ allow(checker).to receive_messages(search_result: true, found_emails: [], reset_found_emails: [], start: nil,
92
+ stop: nil)
103
93
  checker
104
94
  end
105
95
 
@@ -6,7 +6,7 @@ describe MailHandler::Receiving::Checker do
6
6
  subject(:receiving_checker) { described_class.new }
7
7
 
8
8
  it '.create' do
9
- expect(receiving_checker).to be_kind_of described_class
9
+ expect(receiving_checker).to be_a described_class
10
10
  end
11
11
 
12
12
  it 'init details' do
@@ -6,7 +6,7 @@ describe MailHandler::Receiving::FolderChecker do
6
6
  subject(:folder_checker) { described_class.new }
7
7
 
8
8
  it '.create' do
9
- expect(folder_checker).to be_kind_of MailHandler::Receiving::Checker
9
+ expect(folder_checker).to be_a MailHandler::Receiving::Checker
10
10
  end
11
11
 
12
12
  context 'search emails' do
@@ -99,12 +99,12 @@ describe MailHandler::Receiving::FolderChecker do
99
99
  end
100
100
 
101
101
  context 'found' do
102
- let(:mail1) { Mail.read_from_string(File.read("#{data_folder}/email1.txt")) }
103
- let(:mail2) { Mail.read_from_string(File.read("#{data_folder}/email2.txt")) }
102
+ let(:email_to_find) { Mail.read_from_string(File.read("#{data_folder}/email1.txt")) }
103
+ let(:other_email_to_find) { Mail.read_from_string(File.read("#{data_folder}/email2.txt")) }
104
104
 
105
105
  context 'search results' do
106
106
  let(:search) do
107
- checker.find(by_subject: mail1.subject)
107
+ checker.find(by_subject: email_to_find.subject)
108
108
  checker
109
109
  end
110
110
 
@@ -119,16 +119,16 @@ describe MailHandler::Receiving::FolderChecker do
119
119
  end
120
120
 
121
121
  it 'result' do
122
- expect(checker.find(by_subject: mail1.subject)).to be true
122
+ expect(checker.find(by_subject: email_to_find.subject)).to be true
123
123
  end
124
124
 
125
125
  it 'by folder_checker - single' do
126
- checker.find(by_subject: mail1.subject)
126
+ checker.find(by_subject: email_to_find.subject)
127
127
 
128
128
  aggregate_failures 'found mail details' do
129
129
  expect(checker.found_emails.size).to be 1
130
- expect(checker.found_emails.first).to eq mail1
131
- expect(checker.found_emails).not_to include mail2
130
+ expect(checker.found_emails.first).to eq email_to_find
131
+ expect(checker.found_emails).not_to include other_email_to_find
132
132
  end
133
133
  end
134
134
 
@@ -142,8 +142,8 @@ describe MailHandler::Receiving::FolderChecker do
142
142
 
143
143
  aggregate_failures 'found mail details' do
144
144
  expect(checker.found_emails.size).to be 2
145
- expect(checker.found_emails).to include mail1
146
- expect(checker.found_emails).to include mail2
145
+ expect(checker.found_emails).to include email_to_find
146
+ expect(checker.found_emails).to include other_email_to_find
147
147
  end
148
148
  end
149
149
 
@@ -185,7 +185,7 @@ describe MailHandler::Receiving::FolderChecker do
185
185
 
186
186
  context 'archiving emails' do
187
187
  before do
188
- FileUtils.mkdir "#{data_folder}/checked" unless Dir.exist? "#{data_folder}/checked"
188
+ FileUtils.mkdir_p "#{data_folder}/checked"
189
189
  end
190
190
 
191
191
  after do
@@ -195,7 +195,7 @@ describe MailHandler::Receiving::FolderChecker do
195
195
  let(:mail) do
196
196
  mail = Mail.read_from_string(File.read("#{data_folder}/email2.txt"))
197
197
  mail.subject = 'test 872878278'
198
- File.open("#{data_folder}/email3.txt", 'w') { |file| file.write(mail) }
198
+ File.write("#{data_folder}/email3.txt", mail)
199
199
  mail
200
200
  end
201
201
 
@@ -6,7 +6,7 @@ describe MailHandler::Receiving::IMAPChecker do
6
6
  let(:checker) { described_class.new }
7
7
 
8
8
  it '.create' do
9
- expect(checker).to be_kind_of MailHandler::Receiving::Checker
9
+ expect(checker).to be_a MailHandler::Receiving::Checker
10
10
  end
11
11
 
12
12
  it 'options' do
@@ -15,8 +15,7 @@ describe MailHandler::Receiving::IMAPChecker do
15
15
 
16
16
  context 'search options' do
17
17
  before do
18
- allow(checker).to receive(:init_retriever).and_return(true)
19
- allow(checker).to receive(:find_emails).and_return([])
18
+ allow(checker).to receive_messages(init_retriever: true, find_emails: [])
20
19
  end
21
20
 
22
21
  it 'by multiple search options' do
@@ -7,14 +7,14 @@ describe MailHandler::Receiving::Notification::Console do
7
7
 
8
8
  context 'notify of a delay' do
9
9
  it '.notify' do
10
- search = instance_double('Search', started_at: Time.now - 10)
10
+ search = instance_double(MailHandler::Receiver::Search, started_at: Time.now - 10)
11
11
  expect { notification_console.new.notify(search) }.to output(/.+email delay: 0(9|1)0 seconds/).to_stdout
12
12
  end
13
13
  end
14
14
 
15
15
  context 'not notify of a delay' do
16
16
  it '.notify' do
17
- search = instance_double('Search', started_at: Time.now + 5)
17
+ search = instance_double(MailHandler::Receiver::Search, started_at: Time.now + 5)
18
18
  expect { notification_console.new.notify(search) }.to output('').to_stdout
19
19
  end
20
20
  end
@@ -11,7 +11,7 @@ describe MailHandler::Receiving::Notification::EmailContent do
11
11
 
12
12
  describe '.email_received' do
13
13
  it 'create email' do
14
- expect(notification_email_content.retrieve(:received, options, 60, from, to)).to be_kind_of Mail::Message
14
+ expect(notification_email_content.retrieve(:received, options, 60, from, to)).to be_a Mail::Message
15
15
  end
16
16
 
17
17
  context 'email content' do
@@ -3,8 +3,8 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe MailHandler::Receiving::Notification::Email do
6
- let(:search) { instance_double('search') }
7
- let(:sender) { instance_double('sender') }
6
+ let(:search) { instance_double(MailHandler::Receiver::Search) }
7
+ let(:sender) { instance_double(MailHandler::Sender) }
8
8
  let(:notification) { described_class.new(sender, 'from@example.com', 'igor@example.com', 1) }
9
9
 
10
10
  before do
@@ -15,7 +15,7 @@ describe MailHandler::Receiving::Notification::Email do
15
15
  it '.create' do
16
16
  aggregate_failures 'init details' do
17
17
  expect(notification.min_time_to_notify).to eq 1
18
- expect(notification.max_time_to_notify).to eq nil
18
+ expect(notification.max_time_to_notify).to be_nil
19
19
  expect(notification.contacts).to eq 'igor@example.com'
20
20
  expect(notification.sender).to eq sender
21
21
  end
@@ -31,7 +31,7 @@ describe MailHandler::Receiving::Notification::Email do
31
31
  it 'no delay' do
32
32
  allow(search).to receive(:started_at) { Time.now }
33
33
  notification.notify(search)
34
- expect(notification.current_state).to be_kind_of MailHandler::Receiving::Notification::NoDelay
34
+ expect(notification.current_state).to be_a MailHandler::Receiving::Notification::NoDelay
35
35
  end
36
36
 
37
37
  it 'delayed' do
@@ -39,7 +39,7 @@ describe MailHandler::Receiving::Notification::Email do
39
39
  allow(search).to receive(:result).and_return(false)
40
40
  allow(notification).to receive(:send_email).and_return(nil)
41
41
  notification.notify(search)
42
- expect(notification.current_state).to be_kind_of MailHandler::Receiving::Notification::Delay
42
+ expect(notification.current_state).to be_a MailHandler::Receiving::Notification::Delay
43
43
  end
44
44
 
45
45
  it 'received' do
@@ -47,7 +47,7 @@ describe MailHandler::Receiving::Notification::Email do
47
47
  allow(search).to receive(:result).and_return(true)
48
48
  allow(notification).to receive(:send_email).and_return(nil)
49
49
  notification.notify(search)
50
- expect(notification.current_state).to be_kind_of MailHandler::Receiving::Notification::Received
50
+ expect(notification.current_state).to be_a MailHandler::Receiving::Notification::Received
51
51
  end
52
52
 
53
53
  it 'max delayed' do
@@ -55,7 +55,7 @@ describe MailHandler::Receiving::Notification::Email do
55
55
  allow(search).to receive(:result).and_return(false)
56
56
  allow(notification).to receive(:send_email).and_return(nil)
57
57
  notification.notify(search)
58
- expect(notification.current_state).to be_kind_of MailHandler::Receiving::Notification::MaxDelay
58
+ expect(notification.current_state).to be_a MailHandler::Receiving::Notification::MaxDelay
59
59
  end
60
60
  end
61
61
  end
@@ -7,7 +7,7 @@ describe MailHandler::Sender do
7
7
 
8
8
  let(:send_duration) { 3 }
9
9
  let(:dispatcher) do
10
- dispatcher = instance_double('Dispatcher')
10
+ dispatcher = instance_double(MailHandler::Sending::Sender)
11
11
 
12
12
  allow(dispatcher).to receive(:send) do
13
13
  sleep send_duration
@@ -17,27 +17,29 @@ describe MailHandler::Sender do
17
17
  dispatcher
18
18
  end
19
19
  let(:mail) do
20
- Mail.new do
21
- from 'sheldon@bigbangtheory.com'
22
- to 'lenard@bigbangtheory.com'
23
- subject :Hello!
24
- body 'Hello Sheldon!'
25
- end
20
+ Mail.new(
21
+ {
22
+ from: 'sheldon@bigbangtheory.com',
23
+ to: 'lenard@bigbangtheory.com',
24
+ subject: 'Hello',
25
+ body: 'Hello Sheldon!'
26
+ }
27
+ )
26
28
  end
27
29
 
28
30
  let(:sender) { subject.new(dispatcher) }
29
31
 
30
32
  it 'create' do
31
- expect(sender).not_to be nil
33
+ expect(sender).not_to be_nil
32
34
  end
33
35
 
34
36
  it 'init details' do
35
37
  aggregate_failures 'sending details' do
36
- expect(sender.sending.started_at).to be nil
37
- expect(sender.sending.finished_at).to be nil
38
- expect(sender.sending.duration).to be nil
39
- expect(sender.sending.response).to be nil
40
- expect(sender.sending.email).to be nil
38
+ expect(sender.sending.started_at).to be_nil
39
+ expect(sender.sending.finished_at).to be_nil
40
+ expect(sender.sending.duration).to be_nil
41
+ expect(sender.sending.response).to be_nil
42
+ expect(sender.sending.email).to be_nil
41
43
  end
42
44
  end
43
45
 
@@ -29,7 +29,7 @@ describe MailHandler::Sending::SMTPSender do
29
29
 
30
30
  it 'can_authenticated' do
31
31
  sender = smtp_sender.new
32
- expect { sender.can_authenticate? }.to raise_error Errno::ECONNREFUSED
32
+ expect { sender.can_authenticate? }.to raise_error StandardError
33
33
  end
34
34
 
35
35
  it 'type' do
@@ -12,11 +12,11 @@ describe MailHandler::Handler do
12
12
  end
13
13
 
14
14
  it 'create - folder' do
15
- expect(handler.init_receiver(:folder)).to be_kind_of MailHandler::Receiver
15
+ expect(handler.init_receiver(:folder)).to be_a MailHandler::Receiver
16
16
  end
17
17
 
18
18
  it 'create - imap' do
19
- expect(handler.init_receiver(:imap)).to be_kind_of MailHandler::Receiver
19
+ expect(handler.init_receiver(:imap)).to be_a MailHandler::Receiver
20
20
  end
21
21
  end
22
22
 
@@ -28,16 +28,16 @@ describe MailHandler::Handler do
28
28
  end
29
29
 
30
30
  it 'create - postmark api' do
31
- expect(handler.init_sender(:postmark_api)).to be_kind_of MailHandler::Sender
31
+ expect(handler.init_sender(:postmark_api)).to be_a MailHandler::Sender
32
32
  end
33
33
 
34
34
  it 'create - postmark batch api' do
35
- expect(handler.init_sender(:postmark_batch_api)).to be_kind_of MailHandler::Sender
35
+ expect(handler.init_sender(:postmark_batch_api)).to be_a MailHandler::Sender
36
36
  end
37
37
 
38
38
  context 'smtp' do
39
39
  it 'create - smtp' do
40
- expect(handler.init_sender(:smtp)).to be_kind_of MailHandler::Sender
40
+ expect(handler.init_sender(:smtp)).to be_a MailHandler::Sender
41
41
  end
42
42
 
43
43
  context 'set delivery methods' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailhandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.61
4
+ version: 1.0.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Balos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-08 00:00:00.000000000 Z
11
+ date: 2024-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: postmark
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,10 @@ files:
50
50
  - ".circleci/config.yml"
51
51
  - ".gitignore"
52
52
  - ".rubocop.yml"
53
+ - ".ruby-gemset"
54
+ - ".ruby-version"
53
55
  - Gemfile
56
+ - Gemfile.lock
54
57
  - LICENSE
55
58
  - Rakefile
56
59
  - lib/mailhandler.rb
@@ -98,7 +101,8 @@ files:
98
101
  homepage: https://github.com/ActiveCampaign/mailhandler
99
102
  licenses:
100
103
  - MIT
101
- metadata: {}
104
+ metadata:
105
+ rubygems_mfa_required: 'true'
102
106
  post_install_message: "\n ==================\n Thanks for installing the mailhandler
103
107
  gem.\n Review the README.md for implementation details and examples.\n ==================\n
104
108
  \ "
@@ -109,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
113
  requirements:
110
114
  - - ">="
111
115
  - !ruby/object:Gem::Version
112
- version: '0'
116
+ version: 3.0.0
113
117
  required_rubygems_version: !ruby/object:Gem::Requirement
114
118
  requirements:
115
119
  - - ">="
116
120
  - !ruby/object:Gem::Version
117
121
  version: 1.9.3
118
122
  requirements: []
119
- rubygems_version: 3.2.3
123
+ rubygems_version: 3.4.10
120
124
  signing_key:
121
125
  specification_version: 4
122
126
  summary: Postmark email receiving and sending handler.