Module Shoulda::Context::Assertions
In: lib/shoulda/context/assertions.rb

Methods

Public Instance methods

Asserts that the given matcher returns true when target is passed to matches?

Asserts that the given collection contains item x. If x is a regular expression, ensure that at least one element from the collection matches x. extra_msg is appended to the error message if the assertion fails.

  assert_contains(['a', '1'], /\d/) => passes
  assert_contains(['a', '1'], 'a') => passes
  assert_contains(['a', '1'], /not there/) => fails

Asserts that the given collection does not contain item x. If x is a regular expression, ensure that none of the elements from the collection match x.

Asserts that the given matcher returns true when target is passed to does_not_match? or false when target is passed to matches? if does_not_match? is not implemented

Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered.

  assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes

[Validate]