uspec 0.2.2 → 0.2.3

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: 62e31cb81d9310131f0336f4a946e8adbb499cf36864a83d76eaf0054821dff0
4
- data.tar.gz: c91492ba7e80c49e9781af2ce08f5396e269d0f41148c61d682d1d89a603f71d
3
+ metadata.gz: 37c36554e93d2f086beaa00114b033946c8d7fd059ad2436b08677321087e522
4
+ data.tar.gz: 7b3fad4db3c6b602a338d29d98ffdfeb35b8a1f7bdf254595cb336900a623e0d
5
5
  SHA512:
6
- metadata.gz: a0c3a167ad68a9ca32439346761a1520360bf84c52097cf0ed1356b7569c810581d261e65a0b22fae4201415e2e517b589ac6f6dc5c6b95747e41d7dae2f3211
7
- data.tar.gz: 7b8e868bf9d42b008f9b5ee5fc8aea44b557c9d59e7021a500dcf1a08c4ec30a7316c0c6fdaa498ae02fab84b498707f7ce6036fc424b9cc6eba6967ca5eefa9
6
+ metadata.gz: 79f67326d2973ecf2a29868d9630cfae54d1cbd0f8f69458d2794e695b85a40db2876331b71a14a648235e7f0b5581a93249d0b4bfa8c8acfab899112655f4ae
7
+ data.tar.gz: 8b4c7102bdfd0093b01c8a23bb8afd0fb098b74411d3aa9172a0c2515186456a9a925db16d51fe653a9955f1353b075b5cce5886e89df80da3ecde1a349f3b5d
@@ -31,7 +31,7 @@ module Uspec
31
31
  red('Unknown Result'), vspace,
32
32
  hspace, 'Spec did not return a boolean value ', newline,
33
33
  hspace, 'in spec at ', source.first, vspace,
34
- hspace, red(klassinfo), inspector, newline
34
+ hspace, red(subklassinfo), inspector, newline
35
35
  ].join
36
36
  end
37
37
  end
@@ -43,18 +43,18 @@ module Uspec
43
43
  end
44
44
 
45
45
  def message
46
- "#{red klassinfo}#{raw.message}"
46
+ "#{red subklassinfo}#{raw.message}"
47
47
  end
48
48
 
49
- def klassinfo
50
- superklass ? "#{klass} < #{superklass}: " : "#{klass}: "
49
+ def subklassinfo
50
+ "#{handler.subklassinfo}: "
51
51
  end
52
52
 
53
53
  # Attempts to inspect an object
54
54
  def inspector
55
- klass && klass.public_method_defined?(:inspect) ? raw.inspect : "#<#{klass}:0x#{get_id}>"
55
+ handler.inspector!
56
56
  rescue Exception => error
57
- return "#<#{klass}:0x#{get_id}>" if error.message.include? get_id
57
+ return handler.simple_inspector if error.message.include? handler.get_id
58
58
 
59
59
  error_file, error_line, _ = error.backtrace[4].split ?:
60
60
 
@@ -76,40 +76,6 @@ module Uspec
76
76
  MSG
77
77
  end
78
78
 
79
- # Returns the class of the object if it isn't already a class
80
- def klass
81
- Module === raw ? raw : ancestor_klasses[1]
82
- end
83
-
84
- # Returns the superclass of the object
85
- def superklass
86
- ancestor_klasses[2]
87
- end
88
-
89
- # Gets the object ID of an object
90
- def get_id
91
- raw.__id__.to_s(16) rescue 0
92
- end
93
-
94
- # Obtain the singleton class of an object
95
- def singleton
96
- @singleton ||= (class << raw; self; end) rescue raw.class
97
- end
98
-
99
- def ancestor_klasses
100
- @ancestor_klasses ||= ancestors.select{|a| a.is_a? Class}
101
- end
102
-
103
- # Collects the ancestors of an object
104
- def ancestors
105
- @ancestors ||= safe_send singleton, :ancestors
106
- end
107
-
108
- # Works around BasicObject and other objects that are missing/overwrite important methods
109
- def safe_send object, method, *args, &block
110
- (Module === object ? Module : Object).instance_method(method).bind(object).call(*args, &block)
111
- end
112
-
113
79
  def inspect
114
80
  "#{self.class} for `#{spec}` -> #{pretty}"
115
81
  end
@@ -1,3 +1,3 @@
1
1
  module Uspec
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -22,6 +22,8 @@ Gem::Specification.new do |gem|
22
22
  # technically should still work in 2.0 but some of the test suite won't pass
23
23
  gem.required_ruby_version = ">= 2.1"
24
24
 
25
+ gem.add_dependency "that_object_is_so_basic", "~> 0.0.5"
26
+
25
27
  gem.add_development_dependency "pry"
26
28
  gem.add_development_dependency "pry-doc"
27
29
  end
@@ -15,7 +15,7 @@ obj = TestObject.new
15
15
 
16
16
  spec "ensure BasicObject subclasses work" do
17
17
  result = Uspec::Result.new "BasicObject Subclass Result", obj, []
18
- expected = "#<TestObject:"
18
+ expected = "#<BasicObject/TestObject:"
19
19
  actual = result.pretty
20
20
  actual.include?(expected) || result.inspector
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony M. Cook
@@ -10,6 +10,20 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: that_object_is_so_basic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.5
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: pry
15
29
  requirement: !ruby/object:Gem::Requirement