minitest-utils 0.2.6 → 0.2.7
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 +4 -4
- data/lib/minitest/utils.rb +5 -5
- data/lib/minitest/utils/extension.rb +1 -1
- data/lib/minitest/utils/rails.rb +37 -14
- data/lib/minitest/utils/rails/capybara.rb +12 -10
- data/lib/minitest/utils/rails/database_cleaner.rb +8 -6
- data/lib/minitest/utils/rails/locale.rb +27 -4
- data/lib/minitest/utils/rails/webmock.rb +7 -5
- data/lib/minitest/utils/reporter.rb +15 -15
- data/lib/minitest/utils/version.rb +1 -1
- data/lib/minitest/utils_plugin.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d3062a8a9a9d166f1108179f0609a831afb6c5
|
4
|
+
data.tar.gz: 04f45a1bd44005760e60227074fd52dde090d2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17cb273b77044562aff6f02ea0096b6094e368ce2bccf2959814be895250746b0a803db317fa5cfd0fea16e3ada430fb028f244094903aedd515c6a995405c5
|
7
|
+
data.tar.gz: 95738cd2b9611f249ee218468e7c556a1dac26def7cb3ed371d0643a32fc2d75030ca5c713c18dbc0a396cb1a5afc291776ad402ffee463ef6e90fd5e2d5afbc
|
data/lib/minitest/utils.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Minitest
|
2
2
|
module Utils
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
3
|
+
require "minitest"
|
4
|
+
require "minitest/utils/version"
|
5
|
+
require "minitest/utils/reporter"
|
6
|
+
require "minitest/utils/extension"
|
7
|
+
require "minitest/utils/test_notifier_reporter"
|
8
8
|
end
|
9
9
|
end
|
@@ -59,7 +59,7 @@ module Minitest
|
|
59
59
|
target = instance_method(name) rescue nil
|
60
60
|
message = "Cannot define let(:#{name});"
|
61
61
|
|
62
|
-
raise ArgumentError, "#{message} method cannot begin with 'test'." if name.to_s.start_with?(
|
62
|
+
raise ArgumentError, "#{message} method cannot begin with 'test'." if name.to_s.start_with?("test")
|
63
63
|
raise ArgumentError, "#{message} method already defined by #{target.owner}." if target
|
64
64
|
|
65
65
|
define_method(name) do
|
data/lib/minitest/utils/rails.rb
CHANGED
@@ -1,24 +1,47 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Minitest
|
2
|
+
module Utils
|
3
|
+
module UrlHelpers
|
4
|
+
include Rails.application.routes.url_helpers
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'minitest/utils/rails/factory_girl' if defined?(FactoryGirl)
|
7
|
-
require 'minitest/utils/rails/database_cleaner' if defined?(DatabaseCleaner)
|
6
|
+
def default_url_options
|
7
|
+
config = Rails.configuration
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
Rails.application.routes.default_url_options ||
|
10
|
+
config.action_controller.default_url_options ||
|
11
|
+
config.action_mailer.default_url_options ||
|
12
|
+
{}
|
13
|
+
end
|
14
|
+
end
|
11
15
|
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module ActiveSupport
|
19
|
+
class TestCase
|
20
|
+
extend Minitest::Spec::DSL if defined?(Minitest::Spec::DSL)
|
21
|
+
|
22
|
+
require "minitest/utils/rails/webmock" if defined?(WebMock)
|
23
|
+
require "minitest/utils/rails/capybara" if defined?(Capybara)
|
24
|
+
require "minitest/utils/rails/factory_girl" if defined?(FactoryGirl)
|
25
|
+
require "minitest/utils/rails/database_cleaner" if defined?(DatabaseCleaner)
|
12
26
|
|
13
|
-
|
14
|
-
|
27
|
+
def t(*args)
|
28
|
+
I18n.t(*args)
|
29
|
+
end
|
30
|
+
|
31
|
+
def l(*args)
|
32
|
+
I18n.l(*args)
|
33
|
+
end
|
15
34
|
end
|
16
35
|
end
|
17
36
|
|
18
|
-
|
19
|
-
|
37
|
+
module ActionController
|
38
|
+
class TestCase
|
39
|
+
include Minitest::Utils::UrlHelpers
|
40
|
+
end
|
41
|
+
end
|
20
42
|
|
21
|
-
|
22
|
-
|
43
|
+
module ActionMailer
|
44
|
+
class TestCase
|
45
|
+
include Minitest::Utils::UrlHelpers
|
23
46
|
end
|
24
47
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require "capybara/rails"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module ActionDispatch
|
4
|
+
class IntegrationTest
|
5
|
+
include Capybara::DSL
|
5
6
|
|
6
|
-
setup do
|
7
|
-
Capybara.reset_sessions!
|
8
|
-
Capybara.use_default_driver
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.use_javascript!
|
12
7
|
setup do
|
13
|
-
Capybara.
|
8
|
+
Capybara.reset_sessions!
|
9
|
+
Capybara.use_default_driver
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.use_javascript!
|
13
|
+
setup do
|
14
|
+
Capybara.current_driver = Capybara.javascript_driver
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module ActiveSupport
|
2
|
+
class TestCase
|
3
|
+
setup do
|
4
|
+
DatabaseCleaner.start
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
teardown do
|
8
|
+
DatabaseCleaner.clean
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,6 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module ActionDispatch
|
2
|
+
class IntegrationTest
|
3
|
+
include Minitest::Utils::UrlHelpers
|
4
|
+
|
5
|
+
setup do
|
6
|
+
Rails.application.routes.default_url_options[:locale] = I18n.locale
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module ActionController
|
12
|
+
class TestCase
|
13
|
+
include Minitest::Utils::UrlHelpers
|
14
|
+
|
15
|
+
setup do
|
16
|
+
Rails.application.routes.default_url_options[:locale] = I18n.locale
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module ActionMailer
|
22
|
+
class TestCase
|
23
|
+
include Minitest::Utils::UrlHelpers
|
24
|
+
|
25
|
+
setup do
|
26
|
+
Rails.application.routes.default_url_options[:locale] = I18n.locale
|
27
|
+
end
|
5
28
|
end
|
6
29
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "webmock/minitest"
|
2
2
|
|
3
3
|
WebMock.disable_net_connect!(allow: %w[codeclimate.com])
|
4
4
|
|
@@ -6,12 +6,14 @@ def WebMock.requests
|
|
6
6
|
@requests ||= []
|
7
7
|
end
|
8
8
|
|
9
|
-
WebMock.after_request do |request,
|
9
|
+
WebMock.after_request do |request, _response|
|
10
10
|
WebMock.requests << request
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
module ActiveSupport
|
14
|
+
class TestCase
|
15
|
+
setup do
|
16
|
+
WebMock.requests.clear
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
@@ -2,10 +2,10 @@ module Minitest
|
|
2
2
|
module Utils
|
3
3
|
class Reporter < Minitest::StatisticsReporter
|
4
4
|
COLOR_FOR_RESULT_CODE = {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
"." => :green,
|
6
|
+
"E" => :red,
|
7
|
+
"F" => :red,
|
8
|
+
"S" => :yellow
|
9
9
|
}
|
10
10
|
|
11
11
|
COLOR = {
|
@@ -69,16 +69,16 @@ module Minitest
|
|
69
69
|
|
70
70
|
def summary # :nodoc:
|
71
71
|
[
|
72
|
-
pluralize(
|
73
|
-
pluralize(
|
74
|
-
pluralize(
|
75
|
-
pluralize(
|
76
|
-
pluralize(
|
77
|
-
].join(
|
72
|
+
pluralize("run", count),
|
73
|
+
pluralize("assertion", assertions),
|
74
|
+
pluralize("failure", failures),
|
75
|
+
pluralize("error", errors),
|
76
|
+
pluralize("skip", skips)
|
77
|
+
].join(", ")
|
78
78
|
end
|
79
79
|
|
80
80
|
def indent(text)
|
81
|
-
text.gsub(/^/,
|
81
|
+
text.gsub(/^/, " ")
|
82
82
|
end
|
83
83
|
|
84
84
|
def display_failing(result, index)
|
@@ -116,7 +116,7 @@ module Minitest
|
|
116
116
|
filter_backtrace(result.failure.backtrace)
|
117
117
|
.find {|line| line.match(%r((test|spec)/.*?_(test|spec).rb)) }
|
118
118
|
.to_s
|
119
|
-
.gsub(/:\d+.*?$/,
|
119
|
+
.gsub(/:\d+.*?$/, "")
|
120
120
|
end
|
121
121
|
|
122
122
|
def backtrace(backtrace)
|
@@ -131,7 +131,7 @@ module Minitest
|
|
131
131
|
|
132
132
|
return location unless location.start_with?(Dir.pwd)
|
133
133
|
|
134
|
-
location.gsub(%r[^#{Regexp.escape(Dir.pwd)}/],
|
134
|
+
location.gsub(%r[^#{Regexp.escape(Dir.pwd)}/], "")
|
135
135
|
end
|
136
136
|
|
137
137
|
def filter_backtrace(backtrace)
|
@@ -140,8 +140,8 @@ module Minitest
|
|
140
140
|
|
141
141
|
def result_name(name)
|
142
142
|
name
|
143
|
-
.gsub(/^test(_\d+)?_/,
|
144
|
-
.gsub(/_/,
|
143
|
+
.gsub(/^test(_\d+)?_/, "")
|
144
|
+
.gsub(/_/, " ")
|
145
145
|
end
|
146
146
|
|
147
147
|
def print_result_code(result_code)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.5.1
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Some utilities for your Minitest day-to-day usage.
|