effective_test_bot 1.1.11 → 1.1.12

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: 585e3fba653c6552f2c5e127f93d9c567765847f6b16d197cec250930189b2ce
4
- data.tar.gz: 6aaa4625f746dab1ca25747ea129ebb5c56e1ce10a9bba9ea5ea6751e1990498
3
+ metadata.gz: d9e6f40e99b361f8261cf090e3ec20abafbf5cc8fe3f0203be28b0a8b9b60aa8
4
+ data.tar.gz: '0841d1cff3111e0a29f0c219e016f9c1390382e409f8e2e349371417f016d6ea'
5
5
  SHA512:
6
- metadata.gz: 7eb710602f813deb1b36b8d8cb05d1e6a769f7192740b1d95be9972fa4b3bb34148bc9dfc7a1cc50dd3806335f5e17fc1f583dc46e247ce04eef6c6ebea03a18
7
- data.tar.gz: ed40fe78be9f2c7546fb53e9b721cf322699ac330867e3bf29a2969a98e0184c8e5cd3bd41981b04f2881e0be4fc6f4e47de1e46821fda5b1afa6d54e618cef4
6
+ metadata.gz: 5a969606bb8d8032a2e81f7b9b1194ae069460d86f6e375101a061d1f9ac9fac8686e2f5db32e3eb115dd2f70105f7eff9c28f093819d4d6e330de6e9962a0d6
7
+ data.tar.gz: fd048bc80b9105bab36f26f8917c9ca4716f92be4d3a39df270a3a991162f841c408ff7de40cf8ad028472be88c250e5153ed2bcc6af8baabb596860ea211ee5
@@ -5,12 +5,12 @@ module EffectiveTestBotControllerHelper
5
5
  def assign_test_bot_payload(payload = {})
6
6
  payload.merge!({ response_code: response.code, assigns: test_bot_view_assigns, flash: flash.to_hash })
7
7
 
8
- if response.content_type == 'text/html' && response.body[BODY_TAG].present?
8
+ if response.content_type.to_s.start_with?('text/html') && response.body[BODY_TAG].present?
9
9
  payload = view_context.content_tag(:script, build_payload_javascript(payload), id: 'test_bot_payload')
10
10
 
11
11
  split = response.body.split(BODY_TAG)
12
12
  response.body = "#{split.first}#{payload}#{BODY_TAG}#{split.last if split.size > 1}"
13
- elsif response.content_type == 'text/javascript' && response.body.present?
13
+ elsif response.content_type.to_s.start_with?('text/javascript') && response.body.present?
14
14
  payload = build_payload_javascript(payload)
15
15
 
16
16
  response.body = "#{response.body};#{payload}"
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.1.11'.freeze
2
+ VERSION = '1.1.12'.freeze
3
3
  end
@@ -228,7 +228,7 @@ module CrudTest
228
228
 
229
229
  after = { count: resource_class.count, archived: (resource_class.where(id: resource.id).first.try(:archived) rescue nil) }
230
230
 
231
- if resource.respond_to?(:archived)
231
+ if resource.respond_to?(:archived) && before[:count] == after[:count]
232
232
  assert_equal(true, after[:archived], "Expected @#{resource_name}.archived? to be true")
233
233
  else
234
234
  assert_equal before[:count]-1, after[:count], "Expected: #{resource_class}.count to decrement by 1"
@@ -17,9 +17,9 @@ module DeviseTest
17
17
  assert_page_normal
18
18
  assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
19
19
 
20
- assert_signed_in(message: 'Expected @current_user to be present after sign up')
21
20
  assert User.where(email: email).first.present?, "Expected user to be present after submitting sign up form at #{new_user_registration_path}"
22
21
  assert_page_content(I18n.t('devise.registrations.signed_up')) unless test_bot_skip?(:page_content)
22
+ assert_signed_in(message: 'Expected @current_user to be present after sign up')
23
23
  end
24
24
 
25
25
  def test_bot_devise_sign_in_valid_test
@@ -40,8 +40,8 @@ module DeviseTest
40
40
  assert_page_normal
41
41
  assert_no_flash_errors unless test_bot_skip?(:no_flash_errors)
42
42
 
43
- assert_signed_in
44
43
  assert_page_content(I18n.t('devise.sessions.signed_in')) unless test_bot_skip?(:page_content)
44
+ assert_signed_in
45
45
 
46
46
  if User.new().respond_to?(:sign_in_count)
47
47
  assert_equal 1, User.where(email: email).first.try(:sign_in_count), "Expected user sign in count to be incremented after signing in"
@@ -63,8 +63,8 @@ module DeviseTest
63
63
  assert_assigns_errors(:user)
64
64
  assert_page_normal
65
65
 
66
- assert_signed_out
67
66
  assert_page_content(I18n.t('devise.failure.invalid', authentication_keys: Devise.authentication_keys.join(', '))) unless test_bot_skip?(:page_content)
67
+ assert_signed_out
68
68
  end
69
69
 
70
70
  end
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.1.11
4
+ version: 1.1.12
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: 2019-10-01 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails