Top Level Namespace
Included Modules
- Spec::Expectations
- Spec::Methods
Extended Modules
- Spec::Expectations
- Spec::Methods
Defined in:
Method Summary
-
assert_diff(before : A, after : B, file = __FILE__, line = __LINE__) forall A, B
The same as
.eq_diff
, but this can be used independently. -
assert_diff_full(before : A, after : B, file = __FILE__, line = __LINE__) forall A, B
The same as
.eq_diff_full
, but this can be used independently. -
eq_diff(value)
The same as
.eq
, but print readable diff report if actual not equals value (!=
). -
eq_diff_full(value)
The same as
.eq_diff
, but this print full diff report. -
print_diff(before, after, io : IO = STDOUT)
Print diff to io.
-
print_diff_full(before, after, io : IO = STDOUT)
Print full diff to io.
Method Detail
def assert_diff(before : A, after : B, file = __FILE__, line = __LINE__) forall A, B
#
The same as .eq_diff
, but this can be used independently.
assert_diff(before, after)
def assert_diff_full(before : A, after : B, file = __FILE__, line = __LINE__) forall A, B
#
The same as .eq_diff_full
, but this can be used independently.
assert_diff_full(before, after)
def eq_diff(value)
#
The same as .eq
, but print readable diff report if actual not equals value (!=
).
x = {a: 1, b: 2, c: 0}
y = {a: 1, b: 2, c: 3}
x.should eq_diff y
# =>
# Expected: {a: 1, b: 2, c: 3}
# got: {a: 1, b: 2, c: 0}
# diff: {
# ...
# - c: 3,
# + c: 0,
# }
def eq_diff_full(value)
#
The same as .eq_diff
, but this print full diff report.
x = {a: 1, b: 2, c: 0}
y = {a: 1, b: 2, c: 3}
x.should eq_diff_full y
# =>
# Expected: {a: 1, b: 2, c: 3}
# got: {a: 1, b: 2, c: 0}
# diff: {
# a: 1,
# b: 2,
# - c: 3,
# + c: 0,
# }
def print_diff(before, after, io : IO = STDOUT)
#
Print diff to io.
Consecutive no-changed are ommited like "...".
Use .assert_diff_full
if you need full-report.
a = Rectangle.new(Point.new(0, 0), 4, 3)
b = Rectangle.new(Point.new(0, 1), 4, 7)
print_diff(a, b)
# =>
# {
# - height: 3,
# + height: 7,
# origin: {
# ...
# - y: 0,
# + y: 1,
# },
# ...
# }
def print_diff_full(before, after, io : IO = STDOUT)
#
Print full diff to io.
a = Rectangle.new(Point.new(0, 0), 4, 3)
b = Rectangle.new(Point.new(0, 1), 4, 7)
print_diff_full(a, b)
# =>
# {
# - height: 3,
# + height: 7,
# origin: {
# x: 0,
# - y: 0,
# + y: 1,
# },
# width: 4,
# }