effective_test_bot 1.2.4 → 1.2.5

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
  SHA256:
3
- metadata.gz: dfb43e3e70877589f36e4686127e142207377f2f1232bc000dac2749c4d2e5bc
4
- data.tar.gz: 48b700956d1bddf075d49abc9c9f4a4d9f32921d0e2bf4268c578518652f6f72
3
+ metadata.gz: fd91036d4b959a1a59934248064b1c42b6bb6e9cf8558b6809b9621fc67aed76
4
+ data.tar.gz: e5bba54a9961847859d1e02963442d4065e75308336a97609eeb351ac9ab671c
5
5
  SHA512:
6
- metadata.gz: 32190b5326ad994c3c2f8ab3eb186bdd47be93fe164649d349e764a2eec54653e4ad38b67d3a0025c6a82325e8a0f89f86093ae1ef8c5fde7fc2fd5544e791b0
7
- data.tar.gz: e2e0c8e3e6c71d969d0cddfb6f925ab2747a803051745172d7e407b8b06231df2b5c14a1ed15b5c69dc32ad255de8885f72bbfe389c1382852659cbb61180d69
6
+ metadata.gz: 574c821e54abc360af9b1f4f11990b8db8f06685a5c25f096621e8933e34a77829134ae9e06eb5836b171d9ba90a34289e7718566986cdd254af7097b0a1f628
7
+ data.tar.gz: 6b3f2fd19df1a688cb2fb1bcfa79a2f7c3baf0a5832fdf80796cc1c7cec842314eb99ad03a64d922ce22f8a5d56795ff8f235d27d05675aa7b7988c9e811573d
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.4'.freeze
2
+ VERSION = '1.2.5'.freeze
3
3
  end
@@ -1,5 +1,4 @@
1
1
  module EffectiveTestBotAssertions
2
- include ActiveJob::TestHelper if defined?(ActiveJob::TestHelper)
3
2
 
4
3
  def assert_page_content(content, message: "(page_content) Expected page content :content: to be present")
5
4
  assert page.has_text?(/#{Regexp.escape(content)}/i, wait: 0), message.sub(':content:', content)
@@ -236,17 +235,19 @@ module EffectiveTestBotAssertions
236
235
  retval
237
236
  end
238
237
 
238
+ #include ActiveJob::TestHelper if defined?(ActiveJob::TestHelper)
239
+
239
240
  # assert_email :new_user_sign_up
240
241
  # assert_email :new_user_sign_up, to: 'newuser@example.com'
241
242
  # assert_email from: 'admin@example.com'
242
- def assert_email(action = nil, to: nil, from: nil, subject: nil, body: nil, message: nil, count: nil, &block)
243
+ def assert_email(action = nil, perform: nil, to: nil, from: nil, subject: nil, body: nil, message: nil, count: nil, &block)
243
244
  retval = nil
244
245
 
245
- perform_enqueued_jobs if respond_to?(:perform_enqueued_jobs)
246
-
247
246
  if block_given?
248
247
  before = ActionMailer::Base.deliveries.length
248
+ perform_enqueued_jobs if perform && respond_to?(:perform_enqueued_jobs)
249
249
  retval = yield
250
+
250
251
  difference = (ActionMailer::Base.deliveries.length - before)
251
252
 
252
253
  if count.present?
@@ -254,6 +255,8 @@ module EffectiveTestBotAssertions
254
255
  else
255
256
  assert (difference > 0), "(assert_email) Expected at least one email to have been delivered"
256
257
  end
258
+ else
259
+ perform_enqueued_jobs if perform && respond_to?(:perform_enqueued_jobs)
257
260
  end
258
261
 
259
262
  if (action || to || from || subject || body).nil?
@@ -110,7 +110,7 @@ module EffectiveTestBotTestHelper
110
110
  end
111
111
 
112
112
  def current_user_assigns_class
113
- current_user_assigns_key.sub('current_').gsub('_', '::').classify.safe_constantize
113
+ current_user_assigns_key.sub('current_', '').gsub('_', '::').classify.safe_constantize
114
114
  end
115
115
 
116
116
  def access_denied_exception
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails