minitest-utils 0.4.7 → 0.4.9

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: 84ff17b12d3ecf5983fca906bad050c72704c79b28e80f0a4af12da0045be9f8
4
- data.tar.gz: 47eb2b47469a7f12247fdb502f482258d137f910f13863aec78ead8511963a03
3
+ metadata.gz: ef86ff4b6bec9c5eb30160fc0ca4bfe7b199a2bc7c25ab58130e5d98a37bcd3f
4
+ data.tar.gz: b7adae97b3be8e392f6975d8194d49762efea60635df6943a03d0a735e9d08c6
5
5
  SHA512:
6
- metadata.gz: 664cf1128e552426b8c9d6089358886d10b7d1ea47896e7c5476fb131de836583bb4ee7c184e8439a6e8c8b67648b54fb0975733ae582d6583ddff864aa34abf
7
- data.tar.gz: 62db581b15916c22304fee4801aec9bba0cd89cc466e3422dc654b30b7c28a2663b22b517fe06ed8087fba8ee09fd06382200fcd54f3fb3c63b8febd61f09514
6
+ metadata.gz: d904701e8d64a581ec414f01de58ce9a4f1e00bb4bf4b71213f4259c9edca71b84ea2182171d827f75819e88e49ebdfab8062c56d82919eca336394ff46447fb
7
+ data.tar.gz: e2f4a293e89dc7e725afd67c3ae2154783c4ed3cd3ff6d48de60c037f5e14a6bc13583e8176fcb06f3b08661241a7b70c5cced430b3382f1f5797845d42c353c
data/.rubocop.yml CHANGED
@@ -5,16 +5,6 @@ inherit_gem:
5
5
  AllCops:
6
6
  TargetRubyVersion: 2.7
7
7
 
8
- Metrics/LineLength:
9
- Exclude:
10
- - test/**/*
11
-
12
- Metrics/AbcSize:
13
- Enabled: false
14
-
15
8
  Style/GlobalVars:
16
9
  Exclude:
17
10
  - test/minitest/utils/let_test.rb
18
-
19
- Metrics:
20
- Enabled: false
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.7"
5
+ VERSION = "0.4.9"
6
6
  end
7
7
  end
@@ -9,8 +9,12 @@ module Minitest
9
9
  reporters.clear
10
10
  reporters << Minitest::Utils::Reporter.new(options[:io], options)
11
11
 
12
- return unless defined?(TestNotifier)
13
-
14
- reporters << TestNotifierReporter.new(options[:io], options)
12
+ begin
13
+ require "test_notifier"
14
+ reporters << Minitest::Utils::TestNotifierReporter.new(options[:io],
15
+ options)
16
+ rescue LoadError
17
+ # noop
18
+ end
15
19
  end
16
20
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rubocop"
27
27
  spec.add_development_dependency "rubocop-fnando"
28
+ spec.add_development_dependency "test_notifier"
28
29
  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.7
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-01-12 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
@@ -94,6 +93,20 @@ dependencies:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: test_notifier
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
97
110
  description: Some utilities for your Minitest day-to-day usage.
98
111
  email:
99
112
  - fnando.vieira@gmail.com
@@ -135,7 +148,6 @@ files:
135
148
  homepage: http://github.com/fnando/minitest-utils
136
149
  licenses: []
137
150
  metadata: {}
138
- post_install_message:
139
151
  rdoc_options: []
140
152
  require_paths:
141
153
  - lib
@@ -150,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
162
  - !ruby/object:Gem::Version
151
163
  version: '0'
152
164
  requirements: []
153
- rubygems_version: 3.3.3
154
- signing_key:
165
+ rubygems_version: 3.6.2
155
166
  specification_version: 4
156
167
  summary: Some utilities for your Minitest day-to-day usage.
157
168
  test_files: []