test-unit-activesupport 1.0.8 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/doc/text/news.md +34 -0
- data/lib/test/unit/active_support/version.rb +2 -2
- data/lib/test/unit/active_support.rb +34 -3
- data/test/run-test.rb +5 -4
- data/test/test_assertions.rb +27 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 24723125f2083bcbeab4c3e54c0929dc5502f367c7a1be1e17114a81beffaf43
|
4
|
+
data.tar.gz: 2784b88a125ce8e669f443a4b4ab2de3c8378ecc3ddb5b0557a248fc80c0a164
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc01f3155c8efdcc1753055f9fdcf4942ea5bf8d23d64bae27e4974518af235e8a91afe2c75b02bfbbb08a4ec0caa7ee268741fc40d492643c31743f5312b633
|
7
|
+
data.tar.gz: b36b2f836a9e6bf4f5b8138d6f9410b1b749600f843611e80e35cc782fbca90b900b4049e8bc08ef622dd5f7703c05a94a64f5450057d627f3368af7b791d86d
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.1 - 2021-03-06 {#1-1-1}
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
* Fixed a bug that Ruby < 2.3 support is dropped.
|
8
|
+
[GitHub#15][Patch by Akira Matsuda]
|
9
|
+
|
10
|
+
### Thanks
|
11
|
+
|
12
|
+
* Akira Matsuda
|
13
|
+
|
14
|
+
## 1.1.0 - 2021-02-20 {#1-1-0}
|
15
|
+
|
16
|
+
### Improvements
|
17
|
+
|
18
|
+
* Added support for exception in assertions defined by Active
|
19
|
+
Support 6 or later.
|
20
|
+
[GitHub#14][Reported by Yuki Morohoshi]
|
21
|
+
|
22
|
+
### Thanks
|
23
|
+
|
24
|
+
* Yuki Morohoshi
|
25
|
+
|
26
|
+
## 1.0.9 - 2017-07-26 {#1-0-9}
|
27
|
+
|
28
|
+
### Improvements
|
29
|
+
|
30
|
+
* Supported `#before_setup` and `#after_teardown`.
|
31
|
+
[GitHub:test-unit-rails#15][Reported by naofumi-fujii]
|
32
|
+
|
33
|
+
### Thanks
|
34
|
+
|
35
|
+
* naofumi-fujii
|
36
|
+
|
3
37
|
## 1.0.8 - 2016-12-20 {#1-0-8}
|
4
38
|
|
5
39
|
### Fixes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
1
|
+
# Copyright (C) 2012-2022 Sutou Kouhei <kou@clear-code.com>
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -17,7 +17,7 @@
|
|
17
17
|
module Test
|
18
18
|
module Unit
|
19
19
|
module ActiveSupport
|
20
|
-
VERSION = "1.
|
20
|
+
VERSION = "1.1.1"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2022 Sutou Kouhei <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -25,6 +23,11 @@ begin
|
|
25
23
|
rescue LoadError
|
26
24
|
# Active Support < 5 doesn't have file_fixtures
|
27
25
|
end
|
26
|
+
begin
|
27
|
+
require "active_support/testing/tagged_logging"
|
28
|
+
rescue LoadError
|
29
|
+
# Active Support < 7 doesn't have tagged_logging
|
30
|
+
end
|
28
31
|
|
29
32
|
as_test_case_name = "active_support/test_case.rb"
|
30
33
|
unless $LOADED_FEATURES.any? {|feature| feature.end_with?(as_test_case_name)}
|
@@ -45,13 +48,24 @@ module ActiveSupport
|
|
45
48
|
end
|
46
49
|
|
47
50
|
class TestCase < ::Test::Unit::TestCase
|
51
|
+
alias_method :assert_nothing_raised_original, :assert_nothing_raised
|
48
52
|
include ActiveSupport::Testing::Assertions
|
53
|
+
alias_method :assert_nothing_raised, :assert_nothing_raised_original
|
49
54
|
include ActiveSupport::Testing::FileFixtures if defined?(ActiveSupport::Testing::FileFixtures)
|
55
|
+
include ActiveSupport::Testing::TaggedLogging if defined?(ActiveSupport::Testing::TaggedLogging)
|
50
56
|
|
51
57
|
# shoulda needs ActiveSupport::TestCase::Assertion, which is not
|
52
58
|
# set in test-unit 3
|
53
59
|
Assertion = Test::Unit::AssertionFailedError
|
54
60
|
|
61
|
+
setup :before => :prepend
|
62
|
+
def before_setup
|
63
|
+
end
|
64
|
+
|
65
|
+
teardown :after => :append
|
66
|
+
def after_teardown
|
67
|
+
end
|
68
|
+
|
55
69
|
# rails 4.1 (action dispatch assertions) needs the 'message'
|
56
70
|
# method which is not defined in test-unit 3
|
57
71
|
def message(msg=nil, ending=nil, &default)
|
@@ -72,5 +86,22 @@ module ActiveSupport
|
|
72
86
|
def mu_pp(object)
|
73
87
|
AssertionMessage.convert(object)
|
74
88
|
end
|
89
|
+
|
90
|
+
if private_method_defined?(:_assert_nothing_raised_or_warn)
|
91
|
+
def _assert_nothing_raised_or_warn(assertion, &block)
|
92
|
+
assert_nothing_raised(&block)
|
93
|
+
rescue Test::Unit::AssertionFailedError => e
|
94
|
+
if tagged_logger && tagged_logger.warn?
|
95
|
+
warning = <<-MSG.gsub(/^\s+/, "")
|
96
|
+
#{self.class} - #{name}: #{e.error.class} raised.
|
97
|
+
If you expected this exception, use `assert_raise` as near to the code that raises as possible.
|
98
|
+
Other block based assertions (e.g. `#{assertion}`) can be used, as long as `assert_raise` is inside their block.
|
99
|
+
MSG
|
100
|
+
tagged_logger.warn warning
|
101
|
+
end
|
102
|
+
|
103
|
+
raise
|
104
|
+
end
|
105
|
+
end
|
75
106
|
end
|
76
107
|
end
|
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2015-2022 Kouhei Sutou <kou@clear-code.com>
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,10 +16,11 @@
|
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
|
-
base_dir = File.expand_path("..")
|
20
|
-
lib_dir = File.join(base_dir)
|
19
|
+
base_dir = File.expand_path(File.join(__dir__, ".."))
|
20
|
+
lib_dir = File.join(base_dir, "lib")
|
21
21
|
$LOAD_PATH.unshift(lib_dir)
|
22
22
|
|
23
23
|
require "test/unit/active_support"
|
24
24
|
|
25
|
-
|
25
|
+
test_dir = File.join(base_dir, "test")
|
26
|
+
exit(Test::Unit::AutoRunner.run(true, test_dir))
|
data/test/test_assertions.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2015-2022 Kouhei Sutou <kou@clear-code.com>
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -26,12 +26,38 @@ class TestAssertions < ActiveSupport::TestCase
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
test "assert_difference: raise" do
|
30
|
+
x = 1
|
31
|
+
if ActiveSupport.version < Gem::Version.new("6")
|
32
|
+
assert_raise(RuntimeError.new("Unexpected")) do
|
33
|
+
assert_difference("x", 1) do
|
34
|
+
raise "Unexpected"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
else
|
38
|
+
assert_raise(Test::Unit::AssertionFailedError) do
|
39
|
+
assert_difference("x", 1) do
|
40
|
+
raise "Unexpected"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
29
46
|
test "assert_no_difference" do
|
30
47
|
x = 1
|
31
48
|
assert_no_difference("x") do
|
32
49
|
end
|
33
50
|
end
|
34
51
|
|
52
|
+
|
53
|
+
test "assert_nothing_raised" do
|
54
|
+
assert_raise(Test::Unit::AssertionFailedError) do
|
55
|
+
assert_nothing_raised do
|
56
|
+
raise "Unexpected"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
35
61
|
test "message method" do
|
36
62
|
delayed_message = message("test", "bernd") do
|
37
63
|
"hans"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -143,12 +143,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
|
-
|
147
|
-
rubygems_version: 2.5.2
|
146
|
+
rubygems_version: 3.4.0.dev
|
148
147
|
signing_key:
|
149
148
|
specification_version: 4
|
150
149
|
summary: test-unit-activesupport is an ActiveSupport adapter for test-unit 3. You
|
151
150
|
can use full test-unit 3 features with `ActiveSupport::TestCase`.
|
152
151
|
test_files:
|
153
|
-
- test/test_assertions.rb
|
154
152
|
- test/run-test.rb
|
153
|
+
- test/test_assertions.rb
|