assert-moar 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/assert_moar/assertions.rb +10 -0
- data/lib/assert_moar/version.rb +1 -1
- data/test/lib/assert_moar/assertions_test.rb +10 -0
- data/test/test_helper.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd60df7200e675f3b89415c79d21500d35ae834
|
4
|
+
data.tar.gz: cd7d45a1d3b8dbf95932fbfbd16d591fb9fe5f8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff85988edecf6d579d47c1f9b0ede6d25a5ea3c955cedcee2822407ad607c8b4f4c78d384ae5e721537a1660f07237012c8c22e5de8cbca4c9edaa9aaf74e421
|
7
|
+
data.tar.gz: f4d9d78fcc7f7b911610e3331b037bf0257d9d6b233d9d4f7e0348892c81671b14ee6f5f0c9e70cd88669911ef7a9fa3b474115d806e3536b1660ca61cdab971
|
data/README.md
CHANGED
@@ -57,6 +57,16 @@ module AssertMoar::Assertions
|
|
57
57
|
refute object.valid?, "Expected object to not be valid"
|
58
58
|
end
|
59
59
|
|
60
|
+
def assert_memoizes_method_result(object, method)
|
61
|
+
result = object.send(method)
|
62
|
+
assert_same object.send(method), result
|
63
|
+
end
|
64
|
+
|
65
|
+
def refute_memoizes_method_result(object, method)
|
66
|
+
result = object.send(method)
|
67
|
+
refute_same object.send(method), result
|
68
|
+
end
|
69
|
+
|
60
70
|
private
|
61
71
|
def has_validator?(object_or_class, property, validator_class)
|
62
72
|
klass = object_or_class.class
|
data/lib/assert_moar/version.rb
CHANGED
@@ -77,6 +77,16 @@ class AssertMoar::AssertionTest < Minitest::Test
|
|
77
77
|
@tc.refute_validates_with_callback(double, :callback)
|
78
78
|
end
|
79
79
|
|
80
|
+
def test_assert_memoizes_method_result
|
81
|
+
double = ActiveRecordDouble.new()
|
82
|
+
@tc.assert_memoizes_method_result(double, :memoized_method)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_refute_memoizes_method_result
|
86
|
+
double = ActiveRecordDouble.new()
|
87
|
+
@tc.refute_memoizes_method_result(double, :non_memoized_method)
|
88
|
+
end
|
89
|
+
|
80
90
|
def teardown
|
81
91
|
assert_equal(@assertion_count, @tc.assertions,
|
82
92
|
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
|
data/test/test_helper.rb
CHANGED