effective_test_bot 1.2.3 → 1.2.7

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: 80ce8222bd314d35d85d3c6fd58620dbd5d8957cd4ece629467968ee3cbb7e5e
4
- data.tar.gz: 322fcb891096428196ce8ce3c51a7692bfae9255c72db164b77aa137d39f31cc
3
+ metadata.gz: a91dcb207c7da77c8a8a1c7f91da5bf31c1ac55910061e673c08265b1c46bee7
4
+ data.tar.gz: 8b94c2061100cab03625f63ea6ef8d2a4dda45d25dd8daf33b2c32adfad4a3e8
5
5
  SHA512:
6
- metadata.gz: 486cf835958bdaae57dcb381ee604d05daecddde263189b090db4986c3a12fbe388c0f3d94a204fa8a211d8ff488694c816482e056ef1680657d56034f63b9c7
7
- data.tar.gz: d66b36d8ede631896e0228970175bfc67f0b6e911f51613b39fb2dbfde56eafab957cc103b54086003f828a9364e7bd9d718b0c1fc3bc7fd3c22e0fd12080ceb
6
+ metadata.gz: 476735f4d0cfc788f2fff4c366e94eaf9960e4be5ce02a92ce709e73c7b503fe9cac6628d0131bfeecbcfc008045fb0dcdcc842451ca56cda0b3a46a00501a90
7
+ data.tar.gz: c1ec5489d1224b57c5cb485711d4fd95e929351c955e9e786e6ec6802bc73aed5541b39ec0a08e963d19925ccc492775e2011f138b1269be16abe79a5bb81638
@@ -3,6 +3,7 @@ require 'effective_test_bot/engine'
3
3
  require 'effective_test_bot/dsl'
4
4
  require 'effective_test_bot/middleware'
5
5
  require 'effective_test_bot/version'
6
+ require 'timecop'
6
7
 
7
8
  module EffectiveTestBot
8
9
  mattr_accessor :passed_tests
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.3'.freeze
2
+ VERSION = '1.2.7'.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,23 @@ module EffectiveTestBotAssertions
236
235
  retval
237
236
  end
238
237
 
238
+
239
+ #include ActiveJob::TestHelper if defined?(ActiveJob::TestHelper)
240
+ def assert_email_perform_enqueued_jobs
241
+ perform_enqueued_jobs if respond_to?(:perform_enqueued_jobs)
242
+ end
243
+
239
244
  # assert_email :new_user_sign_up
240
245
  # assert_email :new_user_sign_up, to: 'newuser@example.com'
241
246
  # 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)
247
+ def assert_email(action = nil, perform: true, to: nil, from: nil, subject: nil, body: nil, message: nil, count: nil, &block)
243
248
  retval = nil
244
249
 
245
- perform_enqueued_jobs if respond_to?(:perform_enqueued_jobs)
246
-
247
250
  if block_given?
248
251
  before = ActionMailer::Base.deliveries.length
252
+ assert_email_perform_enqueued_jobs if perform
249
253
  retval = yield
254
+
250
255
  difference = (ActionMailer::Base.deliveries.length - before)
251
256
 
252
257
  if count.present?
@@ -254,6 +259,8 @@ module EffectiveTestBotAssertions
254
259
  else
255
260
  assert (difference > 0), "(assert_email) Expected at least one email to have been delivered"
256
261
  end
262
+ else
263
+ assert_email_perform_enqueued_jobs if perform
257
264
  end
258
265
 
259
266
  if (action || to || from || subject || body).nil?
@@ -98,7 +98,7 @@ module EffectiveTestBotFormFiller
98
98
  field_name = [field.tag_name, field['type']].compact.join('_')
99
99
 
100
100
  case field_name
101
- when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_url', 'input_color'
101
+ when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_url', 'input_color', 'input_search'
102
102
  if field['class'].to_s.include?('effective_date')
103
103
  fill_input_date(field, value)
104
104
  else
@@ -114,7 +114,7 @@ module EffectiveTestBotFormFiller
114
114
  fill_input_select(field, value)
115
115
  when 'input_file'
116
116
  fill_input_file(field, value)
117
- when 'input_submit', 'input_search', 'input_button'
117
+ when 'input_submit', 'input_button'
118
118
  skip_field_screenshot = true # Do nothing
119
119
  when 'input_hidden'
120
120
  fill_action_text_input(field, value)
@@ -73,6 +73,13 @@ module EffectiveTestBotTestHelper
73
73
  within_first("div.tab-pane##{name.parameterize}") { yield }
74
74
  end
75
75
 
76
+ def with_time_travel(date, &block)
77
+ Timecop.travel(date)
78
+ retval = yield
79
+ Timecop.return
80
+ retval
81
+ end
82
+
76
83
  def click_first(label)
77
84
  click_link(label, match: :first)
78
85
  end
@@ -103,7 +110,7 @@ module EffectiveTestBotTestHelper
103
110
  end
104
111
 
105
112
  def current_user_assigns_class
106
- current_user_assigns_key.sub('current_').gsub('_', '::').classify.safe_constantize
113
+ current_user_assigns_key.sub('current_', '').gsub('_', '::').classify.safe_constantize
107
114
  end
108
115
 
109
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.3
4
+ version: 1.2.7
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-18 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: timecop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: A shared library of rails model & system tests that should pass in every
126
140
  Rails application.
127
141
  email: