sus 0.20.1 → 0.20.2

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: ea560192a54c0bedbc466fceb371a10e6606fd1ba0e0ac454fcefefb2c2437bc
4
- data.tar.gz: 944a2b68b7d167d7900d628d9e8d9abb39b1f50b1722371f23d6794ad42f493c
3
+ metadata.gz: abff2f6428b5b2a3b86b3ad54d32d73f9b78bf58cd1f81bf010cc7593e1c4bc2
4
+ data.tar.gz: 4fb6c173ac38b1c2e2053867d7f8ec768a9cfdd90ddfa8db366ef4af799a3211
5
5
  SHA512:
6
- metadata.gz: be6279ef1448ff76043b78f7e70e18ff7f4bf7638339f7b955cc6d69f9dbe7ec86899aa6f93a519b377a6bbe449c27f21958d8bfbf5409477ca492b102c4fe14
7
- data.tar.gz: 7ef1abdf110295d84738a312854b8a086df4892b3abe8878d67d9408a166a07fb5298c5b5a4c72199f8338f8337c371966daa98fad8fedc2bc9ee32bd8c3ff1b
6
+ metadata.gz: 23f742731558ca0bb9b3a2a09bc3fb01a6f5d8fb2af4309c41d750866f3e3a9f25be059f1c186670132b1eeafb7896d40262cec04c20d0f8c41e2b73b9255136
7
+ data.tar.gz: e1e4ba8a789c2ca7c1c8391e975499185a0860afc738c3fc0b94dc380c3d22434daef20a0992a07179740f5568afb88a0dda4ef97c1485e96af56ac67d2cce57
checksums.yaml.gz.sig CHANGED
Binary file
@@ -147,13 +147,13 @@ module Sus
147
147
  end
148
148
 
149
149
  class Assert
150
- def initialize(identity, message)
150
+ def initialize(identity, assertions)
151
151
  @identity = identity
152
- @message = message
152
+ @assertions = assertions
153
153
  end
154
154
 
155
155
  attr :identity
156
- attr :message
156
+ attr :assertions
157
157
 
158
158
  def each_failure(&block)
159
159
  yield self
@@ -161,7 +161,7 @@ module Sus
161
161
 
162
162
  def message
163
163
  {
164
- text: @message,
164
+ text: assertions.output.string,
165
165
  location: @identity&.to_location
166
166
  }
167
167
  end
@@ -170,21 +170,20 @@ module Sus
170
170
  def assert(condition, message = nil)
171
171
  @count += 1
172
172
 
173
- message ||= "Assertion"
174
173
  backtrace = Output::Backtrace.first(@identity)
175
174
  identity = @identity&.scoped
176
175
 
177
176
  if condition
178
- @passed << Assert.new(identity, message)
177
+ @passed << Assert.new(identity, self)
179
178
 
180
179
  if !@orientation || @verbose
181
- @output.puts(:indent, *pass_prefix, message, backtrace)
180
+ @output.puts(:indent, *pass_prefix, message || "assertion passed", backtrace)
182
181
  end
183
182
  else
184
- @failed << Assert.new(identity, message)
183
+ @failed << Assert.new(identity, self)
185
184
 
186
185
  if @orientation || @verbose
187
- @output.puts(:indent, *fail_prefix, message, backtrace)
186
+ @output.puts(:indent, *fail_prefix, message || "assertion failed", backtrace)
188
187
  end
189
188
  end
190
189
  end
@@ -26,7 +26,7 @@ module Sus
26
26
  rescue @exception_class => exception
27
27
  # Did it have the right message?
28
28
  if @message
29
- @message.call(assertions, exception.message)
29
+ Expect.new(assertions, exception.message).to(@message)
30
30
  else
31
31
  assertions.assert(true, "raised")
32
32
  end
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2022, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.20.1"
7
+ VERSION = "0.20.2"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file