assert-moar 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assert_moar/version.rb +1 -1
- data/lib/minitest/assertions.rb +4 -0
- data/test/lib/minitest/assertions_test.rb +1 -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: fcc1728ac901b97cddff74e59b689e5618f7c26e
|
4
|
+
data.tar.gz: 2b72423b1105203607a90bbde92c6c53d501d3d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b90e1f8d9cf8543e3610071650b4f96ae9b325896666e1605ab4e6b752f85ddb186e2fc21f32d948d2edc29222cf6e5da76519935e4a0693451a2b1af38f96
|
7
|
+
data.tar.gz: f55cfd7da6a40088247728048a45627f402235869a01b78eab2b157b88ef2e2c48d0aea37f0e8536a1db88e45e0474103ffc53d98ccb7d1041ae16412195205c
|
data/lib/assert_moar/version.rb
CHANGED
data/lib/minitest/assertions.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
module MiniTest::Assertions
|
2
2
|
def assert_validates_presence_of(object, property)
|
3
3
|
assert_valid(object)
|
4
|
+
tmp = object.send("#{property}")
|
4
5
|
object.send("#{property}=", nil)
|
5
6
|
refute object.valid?, "Expected object not to be valid"
|
6
7
|
assert object.errors[property.to_sym], "Expected errors to exist for #{property}"
|
8
|
+
object.send("#{property}=", tmp)
|
7
9
|
end
|
8
10
|
|
9
11
|
def refute_validates_presence_of(object, property)
|
10
12
|
assert_valid(object)
|
13
|
+
tmp = object.send("#{property}")
|
11
14
|
object.send("#{property}=", nil)
|
12
15
|
assert_valid(object)
|
13
16
|
assert_nil object.errors[property.to_sym]
|
17
|
+
object.send("#{property}=", tmp)
|
14
18
|
end
|
15
19
|
|
16
20
|
def assert_valid(object)
|