minitest-utils 0.4.8 → 0.4.9

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: 4d7d588847effe487b3ab88b95c74a3b34d250316c85237bc582cec41ba61925
4
- data.tar.gz: 1ecbdd5dd3aae7dd35e84de745d0bc4573570c6bbe43773a54a77e645768cc6b
3
+ metadata.gz: ef86ff4b6bec9c5eb30160fc0ca4bfe7b199a2bc7c25ab58130e5d98a37bcd3f
4
+ data.tar.gz: b7adae97b3be8e392f6975d8194d49762efea60635df6943a03d0a735e9d08c6
5
5
  SHA512:
6
- metadata.gz: dc08883e75123eb2d6798aa2e48887f9071964da06439bdfd16d37ebc98319b7348d8135395566116c2319ce7577b66efd3ca1fa92829e8f4baf0f77a559f665
7
- data.tar.gz: 1b01d7a4aeb7c3fd34badad48ed550cc1bc5c35b6d4c830b0bb3d26d6ac3cacbacc85746b1ab1611352fb5d05271889003b77488daf1dc8d77c17387a1151acb
6
+ metadata.gz: d904701e8d64a581ec414f01de58ce9a4f1e00bb4bf4b71213f4259c9edca71b84ea2182171d827f75819e88e49ebdfab8062c56d82919eca336394ff46447fb
7
+ data.tar.gz: e2f4a293e89dc7e725afd67c3ae2154783c4ed3cd3ff6d48de60c037f5e14a6bc13583e8176fcb06f3b08661241a7b70c5cced430b3382f1f5797845d42c353c
data/README.md CHANGED
@@ -6,7 +6,7 @@ Includes:
6
6
 
7
7
  - A better reporter (see screenshot below)
8
8
  - A [TestNotifier](http://github.com/fnando/test_notifier) reporter
9
- - Some Rails niceties (set up FactoryGirl, WebMock and Capybara)
9
+ - Some Rails niceties (set up FactoryBot, WebMock and Capybara)
10
10
  - Add a `t` and `l` methods (i18n)
11
11
 
12
12
  ## Installation
@@ -27,7 +27,8 @@ Or install it yourself as:
27
27
 
28
28
  ## Defining tests
29
29
 
30
- This gem adds the `Minitest::Test.test` method, so you can easy define your methods like the following:
30
+ This gem adds the `Minitest::Test.test` method, so you can easy define your
31
+ methods like the following:
31
32
 
32
33
  ```ruby
33
34
  class SampleTest < Minitest::Test
@@ -37,7 +38,10 @@ class SampleTest < Minitest::Test
37
38
  end
38
39
  ```
39
40
 
40
- This is equivalent to defining a method named `test_useless_test`. You can also skip the block, which will define a [flunk](https://github.com/seattlerb/minitest/blob/77120c5b2511c4665610cda06c8058c801b28e7f/lib/minitest/assertions.rb#L477-L480) call.
41
+ This is equivalent to defining a method named `test_useless_test`. You can also
42
+ skip the block, which will define a
43
+ [flunk](https://github.com/seattlerb/minitest/blob/77120c5b2511c4665610cda06c8058c801b28e7f/lib/minitest/assertions.rb#L477-L480)
44
+ call.
41
45
 
42
46
  You can also define `setup` and `teardown` steps.
43
47
 
@@ -71,20 +75,30 @@ end
71
75
 
72
76
  ## Screenshots
73
77
 
74
- ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/light-failing.png)
75
- ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/light-success.png)
76
- ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/dark-failing.png)
77
- ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/dark-success.png)
78
+ ![](https://raw.githubusercontent.com/fnando/minitest-utils/main/screenshots/light-failing.png)
79
+ ![](https://raw.githubusercontent.com/fnando/minitest-utils/main/screenshots/light-success.png)
80
+ ![](https://raw.githubusercontent.com/fnando/minitest-utils/main/screenshots/dark-failing.png)
81
+ ![](https://raw.githubusercontent.com/fnando/minitest-utils/main/screenshots/dark-success.png)
78
82
 
79
83
  ## Rails extensions
80
84
 
81
85
  minitest-utils sets up some things for your Rails application.
82
86
 
83
- - [Capybara](https://github.com/jnicklas/capybara): includes `Capybara::DSL`, sets default driver before every test, resets session and creates a helper method for setting JavaScript driver. If you have [poltergeist](https://github.com/teampoltergeist/poltergeist) installed, it will be used as the default JavaScript driver.
84
- - [FactoryGirl](https://github.com/thoughtbot/factory_girl): adds methods to `ActiveSupport::TestCase`.
85
- - [WebMock](https://github.com/bblimke/webmock): disables external requests (except for codeclimate) and tracks all requests on `WebMock.requests`.
86
- - locale routes: sets `Rails.application.routes.default_url_options[:locale]` with your current locale.
87
- - [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner): configure database before running each test. You can configure the strategy by settings `DatabaseCleaner.strategy = :truncation`, for instance. It defaults to `:deletion`.
87
+ - [Capybara](https://github.com/jnicklas/capybara): includes `Capybara::DSL`,
88
+ sets default driver before every test, resets session and creates a helper
89
+ method for setting JavaScript driver. If you have
90
+ [poltergeist](https://github.com/teampoltergeist/poltergeist) installed, it
91
+ will be used as the default JavaScript driver.
92
+ - [FactoryBot](https://github.com/thoughtbot/factory_bot): adds methods to
93
+ `ActiveSupport::TestCase`.
94
+ - [WebMock](https://github.com/bblimke/webmock): disables external requests
95
+ (except for codeclimate) and tracks all requests on `WebMock.requests`.
96
+ - locale routes: sets `Rails.application.routes.default_url_options[:locale]`
97
+ with your current locale.
98
+ - [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner):
99
+ configure database before running each test. You can configure the strategy by
100
+ settings `DatabaseCleaner.strategy = :truncation`, for instance. It defaults
101
+ to `:deletion`.
88
102
  - Other: `t` and `l` alias to I18n.
89
103
 
90
104
  ```ruby
@@ -93,7 +107,8 @@ class SignupTest < ActionDispatch::IntegrationTtest
93
107
  end
94
108
  ```
95
109
 
96
- Also, if you're using routes like `:locale` scope, you can load this file to automatically set your route's `:locale` param.
110
+ Also, if you're using routes like `:locale` scope, you can load this file to
111
+ automatically set your route's `:locale` param.
97
112
 
98
113
  ```ruby
99
114
  require 'minitest/utils/rails/locale'
@@ -101,9 +116,13 @@ require 'minitest/utils/rails/locale'
101
116
 
102
117
  ## Development
103
118
 
104
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
119
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
120
+ `bin/console` for an interactive prompt that will allow you to experiment.
105
121
 
106
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
122
+ To install this gem onto your local machine, run `bundle exec rake install`. To
123
+ release a new version, update the version number in `version.rb`, and then run
124
+ `bundle exec rake release` to create a git tag for the version, push git commits
125
+ and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
107
126
 
108
127
  ## Contributing
109
128
 
@@ -19,7 +19,11 @@ module Minitest
19
19
  include ::Minitest::Utils::Assertions
20
20
 
21
21
  def self.test(name, &block)
22
- test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
22
+ name = name.gsub(/[^a-z0-9]+/, "_")
23
+ .gsub(/^_+/, "")
24
+ .gsub(/_+$/, "")
25
+ .gsub(/_+/, "_")
26
+ test_name = "test_#{name}".to_sym
23
27
  defined = method_defined? test_name
24
28
 
25
29
  raise "#{test_name} is already defined in #{self}" if defined
@@ -23,12 +23,12 @@ module ActiveSupport
23
23
 
24
24
  require "minitest/utils/rails/capybara" if defined?(Capybara)
25
25
 
26
- def t(*args)
27
- I18n.t(*args)
26
+ def t(*args, **kwargs)
27
+ I18n.t(*args, **kwargs)
28
28
  end
29
29
 
30
- def l(*args)
31
- I18n.l(*args)
30
+ def l(*args, **kwargs)
31
+ I18n.l(*args, **kwargs)
32
32
  end
33
33
  end
34
34
  end
@@ -207,6 +207,15 @@ module Minitest
207
207
  end
208
208
 
209
209
  private def build_test_command(location, line, result)
210
+ if ENV["MINITEST_TEST_COMMAND"]
211
+ return format(
212
+ ENV["MINITEST_TEST_COMMAND"],
213
+ location: location,
214
+ line: line,
215
+ name: result.name
216
+ )
217
+ end
218
+
210
219
  if running_rails?
211
220
  %[bin/rails test #{location}:#{line}]
212
221
  else
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Utils
5
- VERSION = "0.4.8"
5
+ VERSION = "0.4.9"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-02-20 00:00:00.000000000 Z
10
+ date: 2025-02-14 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -149,7 +148,6 @@ files:
149
148
  homepage: http://github.com/fnando/minitest-utils
150
149
  licenses: []
151
150
  metadata: {}
152
- post_install_message:
153
151
  rdoc_options: []
154
152
  require_paths:
155
153
  - lib
@@ -164,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
162
  - !ruby/object:Gem::Version
165
163
  version: '0'
166
164
  requirements: []
167
- rubygems_version: 3.3.7
168
- signing_key:
165
+ rubygems_version: 3.6.2
169
166
  specification_version: 4
170
167
  summary: Some utilities for your Minitest day-to-day usage.
171
168
  test_files: []