effective_test_bot 1.1.24 → 1.1.25

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: eccff959a9793ba3408242d0ce772d74ffec74b5e814052ee6ee27086d934491
4
- data.tar.gz: 631e4aca51755e878e549edc85547297bd630c199996b0a67ca34f36ed215e75
3
+ metadata.gz: c93ee6cbc4a6f2d015c6862cc56cb1fbf1c0a56eab77931996bf1f59d771196b
4
+ data.tar.gz: 27a906d8cc6eed02996b0d98297a0bd832af9f0f6199029eafb94bcc4eb8d26d
5
5
  SHA512:
6
- metadata.gz: db5b468dbb02f65c4e2050a77168c1559f30ec12e6d2f046a014e1a815b78450a93d3816956f3500b969fb8ec5cb6e0065f1040eef4649f4a7be780f4e1930cd
7
- data.tar.gz: 7c997a7afa4c1875a44e32c4f8de06713f589d6b5e3a51ffa3e3a04c8c37b999d3d24feadae466d1d2f170e93be3666c1f4448f1f9d7ab5d6167a3c53c4227d1
6
+ metadata.gz: 3243af9fc54f6f92a7e6a34f9690a97aac9b2c2b94b6deaf37bb2981a4bbadd26620900717e2de6ca88be90447c9558c944ac9dfd0e0944e7bcb440298fd2005
7
+ data.tar.gz: 71476e8e08e018a8a4111daabd9c1025fa14003f1079a190b35f8487103b9bbfaaa9990793515b559404993a74bd0fa24fc6728c6294155a1900ad942464b03e
@@ -2,6 +2,7 @@ ENV['RAILS_ENV'] ||= 'test'
2
2
  require_relative '../config/environment'
3
3
 
4
4
  require 'rails/test_help'
5
+ require 'minitest/mock'
5
6
  require 'minitest/spec'
6
7
  require 'minitest/reporters'
7
8
  require 'minitest/fail_fast' if EffectiveTestBot.fail_fast?
@@ -10,6 +11,8 @@ class ActiveSupport::TestCase
10
11
  # Run tests in parallel with specified workers
11
12
  # parallelize(workers: :number_of_processors) if respond_to?(:parallelize)
12
13
 
14
+ include EffectiveTestBot::DSL
15
+
13
16
  fixtures :all # Loads all fixtures in test/fixtures/*.yml
14
17
  extend Minitest::Spec::DSL # For the let syntax
15
18
  end
@@ -3,6 +3,7 @@ module EffectiveTestBot
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
+ # test/support/
6
7
  include EffectiveTestBotAssertions
7
8
  include EffectiveTestBotFormFaker
8
9
  include EffectiveTestBotFormFiller
@@ -12,6 +13,10 @@ module EffectiveTestBot
12
13
  include EffectiveTestBotScreenshotsHelper
13
14
  include EffectiveTestBotTestHelper
14
15
 
16
+ class BasicObject
17
+ include EffectiveTestBotMocks
18
+ end
19
+
15
20
  # test/test_botable/
16
21
  include BaseTest
17
22
  include CrudTest
@@ -3,14 +3,14 @@ module EffectiveTestBot
3
3
  engine_name 'effective_test_bot'
4
4
 
5
5
  config.autoload_paths += Dir[
6
- "#{config.root}/test/test_botable/",
7
- "#{config.root}/test/concerns/",
6
+ "#{config.root}/test/test_botable/",
7
+ "#{config.root}/test/concerns/",
8
8
  "#{config.root}/test/support/"
9
9
  ]
10
10
 
11
11
  config.eager_load_paths += Dir[
12
- "#{config.root}/test/test_botable/",
13
- "#{config.root}/test/concerns/",
12
+ "#{config.root}/test/test_botable/",
13
+ "#{config.root}/test/concerns/",
14
14
  "#{config.root}/test/support/"
15
15
  ]
16
16
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.1.24'.freeze
2
+ VERSION = '1.1.25'.freeze
3
3
  end
@@ -0,0 +1,31 @@
1
+ # https://github.com/codeodor/minitest-stub_any_instance
2
+
3
+ # included on BasicObject when test_helper calls include EffectiveTestBot::DSL
4
+ module EffectiveTestBotMocks
5
+ def stub_any_instance(name, val_or_callable = nil, &block)
6
+ new_name = "__minitest_any_instance_stub__#{name}"
7
+ owns_method = instance_method(name).owner == self
8
+
9
+ class_eval do
10
+ alias_method new_name, name if owns_method
11
+
12
+ define_method(name) do |*args|
13
+ if val_or_callable.respond_to? :call then
14
+ instance_exec(*args, &val_or_callable)
15
+ else
16
+ val_or_callable
17
+ end
18
+ end
19
+ end
20
+
21
+ yield
22
+ ensure
23
+ class_eval do
24
+ remove_method name
25
+ if owns_method
26
+ alias_method name, new_name
27
+ remove_method new_name
28
+ end
29
+ end
30
+ end
31
+ 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.24
4
+ version: 1.1.25
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: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -160,6 +160,7 @@ files:
160
160
  - test/support/effective_test_bot_form_helper.rb
161
161
  - test/support/effective_test_bot_login_helper.rb
162
162
  - test/support/effective_test_bot_minitest_helper.rb
163
+ - test/support/effective_test_bot_mocks.rb
163
164
  - test/support/effective_test_bot_screenshots_helper.rb
164
165
  - test/support/effective_test_bot_test_helper.rb
165
166
  - test/test_bot/system/application_test.rb