test-unit-activesupport 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +24 -0
- data/lib/test/unit/active_support/version.rb +2 -2
- data/lib/test/unit/active_support.rb +7 -4
- data/test/test_assertions.rb +17 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d76553bed49acf2c1fc658c03cebd37b0cfede2b93a3783a62c5161638db3b
|
4
|
+
data.tar.gz: 8ab41c0b7feb01daee504a2b65d770c783f5b42158b0f020b1c78b633b004a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea8ba02fd2123e3bf90c8e6d0ac835c8bf999539e28dee7815523ea5708f0c3e4d56286abad05f6c07b3f841723323f7afd71f8e045b2824e70ab9aac0b36b0
|
7
|
+
data.tar.gz: b4df94c704761a9eb4796864d35408fe2ff89580e571fed193ceecbb545a834858c14026f07aa744ab3581f48882712f12f00a90c172d3da0772bb9e8076666f
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.1.2 - 2024-09-25 {#1-1-2}
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
* Fixed a bug that unexpected exception warning with tagged logger
|
8
|
+
doesn't work. This is happen with Active Support 7 or later.
|
9
|
+
* GH-17
|
10
|
+
* Reported by akira yamada
|
11
|
+
|
12
|
+
### Thanks
|
13
|
+
|
14
|
+
* akira yamada
|
15
|
+
|
16
|
+
## 1.1.1 - 2021-03-06 {#1-1-1}
|
17
|
+
|
18
|
+
### Fixes
|
19
|
+
|
20
|
+
* Fixed a bug that Ruby < 2.3 support is dropped.
|
21
|
+
[GitHub#15][Patch by Akira Matsuda]
|
22
|
+
|
23
|
+
### Thanks
|
24
|
+
|
25
|
+
* Akira Matsuda
|
26
|
+
|
3
27
|
## 1.1.0 - 2021-02-20 {#1-1-0}
|
4
28
|
|
5
29
|
### Improvements
|
@@ -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.1.
|
20
|
+
VERSION = "1.1.2"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
1
|
+
# Copyright (C) 2012-2024 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
|
@@ -91,9 +91,12 @@ module ActiveSupport
|
|
91
91
|
def _assert_nothing_raised_or_warn(assertion, &block)
|
92
92
|
assert_nothing_raised(&block)
|
93
93
|
rescue Test::Unit::AssertionFailedError => e
|
94
|
-
if tagged_logger &&
|
95
|
-
|
96
|
-
|
94
|
+
if tagged_logger &&
|
95
|
+
tagged_logger.warn? &&
|
96
|
+
e.message.start_with?("Exception raised:\n")
|
97
|
+
inspected_exception = e.message.lines[1] || "Unknown exception"
|
98
|
+
warning = <<-MSG.gsub(/^\s+/, "")
|
99
|
+
#{self.class} - #{name}: #{inspected_exception.strip} raised.
|
97
100
|
If you expected this exception, use `assert_raise` as near to the code that raises as possible.
|
98
101
|
Other block based assertions (e.g. `#{assertion}`) can be used, as long as `assert_raise` is inside their block.
|
99
102
|
MSG
|
data/test/test_assertions.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2024 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
|
@@ -14,6 +14,8 @@
|
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
16
|
|
17
|
+
require "stringio"
|
18
|
+
|
17
19
|
class TestAssertions < ActiveSupport::TestCase
|
18
20
|
test "assert_not" do
|
19
21
|
assert_not(false)
|
@@ -34,12 +36,26 @@ class TestAssertions < ActiveSupport::TestCase
|
|
34
36
|
raise "Unexpected"
|
35
37
|
end
|
36
38
|
end
|
39
|
+
elsif ActiveSupport.version < Gem::Version.new("7")
|
40
|
+
assert_raise(Test::Unit::AssertionFailedError) do
|
41
|
+
assert_difference("x", 1) do
|
42
|
+
raise "Unexpected"
|
43
|
+
end
|
44
|
+
end
|
37
45
|
else
|
46
|
+
logdev = StringIO.new
|
47
|
+
self.tagged_logger = ActiveSupport::TaggedLogging.new(Logger.new(logdev))
|
38
48
|
assert_raise(Test::Unit::AssertionFailedError) do
|
39
49
|
assert_difference("x", 1) do
|
40
50
|
raise "Unexpected"
|
41
51
|
end
|
42
52
|
end
|
53
|
+
assert_equal(<<-MESSAGE, logdev.string)
|
54
|
+
#{self.class} - #{name}: RuntimeError(<Unexpected>) raised.
|
55
|
+
If you expected this exception, use `assert_raise` as near to the code that raises as possible.
|
56
|
+
Other block based assertions (e.g. `assert_difference`) can be used, as long as `assert_raise` is inside their block.
|
57
|
+
|
58
|
+
MESSAGE
|
43
59
|
end
|
44
60
|
end
|
45
61
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-09-25 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -128,7 +127,6 @@ homepage: https://github.com/test-unit/test-unit-activesupport
|
|
128
127
|
licenses:
|
129
128
|
- LGPL-2.1
|
130
129
|
metadata: {}
|
131
|
-
post_install_message:
|
132
130
|
rdoc_options: []
|
133
131
|
require_paths:
|
134
132
|
- lib
|
@@ -143,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
141
|
- !ruby/object:Gem::Version
|
144
142
|
version: '0'
|
145
143
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
144
|
+
rubygems_version: 3.6.0.dev
|
148
145
|
specification_version: 4
|
149
146
|
summary: test-unit-activesupport is an ActiveSupport adapter for test-unit 3. You
|
150
147
|
can use full test-unit 3 features with `ActiveSupport::TestCase`.
|