extra_assertions 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/extra_assertions.rb +6 -4
- metadata +3 -3
data/lib/extra_assertions.rb
CHANGED
@@ -11,15 +11,17 @@ module ExtraAssertions
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def assert_valid(record)
|
14
|
+
def assert_valid(record, message = nil)
|
15
|
+
valid = record.valid?
|
15
16
|
assert_block (message || "#{record.class.name} is invalid: #{record.errors.full_messages.join("\n")}") do
|
16
|
-
|
17
|
+
valid
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
def assert_invalid(record)
|
21
|
+
def assert_invalid(record, message = nil)
|
22
|
+
valid = record.valid?
|
21
23
|
assert_block (message || "#{record.class.name} should be invalid.") do
|
22
|
-
!
|
24
|
+
!valid
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extra_assertions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Weiss
|