Module: Assertalot::Assertions
- Defined in:
- lib/assertalot/assertions.rb
Instance Method Summary collapse
- #assert_error_on(model, field) ⇒ Object
- #assert_no_error_on(model, field) ⇒ Object
- #assert_not_blank(thing, message = "must not be blank") ⇒ Object
- #assert_valid_version(str) ⇒ Object
Instance Method Details
#assert_error_on(model, field) ⇒ Object
11 12 13 |
# File 'lib/assertalot/assertions.rb', line 11 def assert_error_on(model, field) assert !model.errors[field.to_sym].blank?, "No validation error on the #{field.to_s} field." end |
#assert_no_error_on(model, field) ⇒ Object
15 16 17 |
# File 'lib/assertalot/assertions.rb', line 15 def assert_no_error_on(model, field) assert model.errors[field.to_sym].blank?, "Validation error on #{field.to_s}." end |
#assert_not_blank(thing, message = "must not be blank") ⇒ Object
3 4 5 |
# File 'lib/assertalot/assertions.rb', line 3 def assert_not_blank thing, ="must not be blank" assert !thing.blank?, end |
#assert_valid_version(str) ⇒ Object
7 8 9 |
# File 'lib/assertalot/assertions.rb', line 7 def assert_valid_version str assert_match /^\d+\.\d+\.\d+$/, str, "The version must be in the form MAJOR.MINOR.PATCH" end |