minitest-implicit-subject 1.1.0 → 1.1.1
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 +8 -8
- data/lib/minitest/implicit/subject.rb +3 -1
- data/spec/lib/minitest/implicit/subject_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTlhNWRlOTUzMGJmN2QwYzA2NGIzNzhiMTY0NGQyNTRmZTgzZGRmYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTRiMjA0Yzk5NzMxYjZiNGY0ZGI3YjNmZTdlN2RlMDQzM2M1NGIxNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjMwNGZkY2QyNTdjN2EzZTliMjBlODQ1ODEyNzBlYmU2Mjk1N2E5MGFlYjRk
|
10
|
+
NDUzN2U5Yjg5MGQ5ZmU0MDczYzA5MTY2ZDRjYTQyY2M2NDY3NDcyYzRhOGNl
|
11
|
+
ZDA1NDY5OGNjZDU1OTgzNGY5MDRkYWMzZTI2Mzc5MzIwYzE0NDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGM3YjA1MjQyYThiOWNjMjg1MDAzNzE4OWQ5ZGJjYjBhN2QwZGExOWI2ZTI4
|
14
|
+
MTA0OTlmZGZkOTQxYmNjYjI0NDI3NDJjZWY3YmQ3OGYyYTlhNTJlZDdlN2Vi
|
15
|
+
MDBiMTYyYmQxM2VkNmY5OWIzMzdlMzcyODAxMGYxYjRiZWVlMTg=
|
@@ -9,7 +9,9 @@ module Kernel
|
|
9
9
|
subject = args.first
|
10
10
|
|
11
11
|
if !subject.is_a?(String) && !cls.instance_methods.include?(:subject)
|
12
|
-
subject
|
12
|
+
if subject.respond_to?(:included_modules) && Array === subject.included_modules && subject.included_modules.include?(Singleton)
|
13
|
+
subject = subject.instance
|
14
|
+
end
|
13
15
|
|
14
16
|
cls.subject { subject }
|
15
17
|
end
|
@@ -26,10 +26,17 @@ describe 'singleton subject' do
|
|
26
26
|
klass = Class.new do
|
27
27
|
include Singleton
|
28
28
|
end
|
29
|
+
struct = OpenStruct.new
|
29
30
|
|
30
31
|
describe klass do
|
31
32
|
it 'defines the singleton instance as the subject' do
|
32
33
|
subject.must_equal klass.instance
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
37
|
+
describe struct do
|
38
|
+
it 'does not blow up if the given subject has no included modules' do
|
39
|
+
subject.must_equal struct
|
40
|
+
end
|
41
|
+
end
|
35
42
|
end
|