Module: GovukAbTesting::MinitestAssertions
- Included in:
- MinitestHelpers
- Defined in:
- lib/govuk_ab_testing/minitest_assertions.rb
Instance Method Summary collapse
- #assert_contains_substring(string:, substring:, error_message:) ⇒ Object
- #assert_does_not_contain_substring(string:, substring:, error_message:) ⇒ Object
- #assert_has_size(enumerable:, size:, error_message:) ⇒ Object
- #assert_is_empty(enumerable:, error_message:) ⇒ Object
- #assert_is_equal(expected:, actual:, error_message:) ⇒ Object
- #assert_not_blank(string:, error_message:) ⇒ Object
Instance Method Details
#assert_contains_substring(string:, substring:, error_message:) ⇒ Object
7 8 9 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 7 def assert_contains_substring(string:, substring:, error_message:) assert_match(/#{substring}/, string, ) end |
#assert_does_not_contain_substring(string:, substring:, error_message:) ⇒ Object
11 12 13 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 11 def assert_does_not_contain_substring(string:, substring:, error_message:) refute_match(/#{substring}/, string, ) end |
#assert_has_size(enumerable:, size:, error_message:) ⇒ Object
15 16 17 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 15 def assert_has_size(enumerable:, size:, error_message:) assert_equal(size, enumerable.count, ) end |
#assert_is_empty(enumerable:, error_message:) ⇒ Object
19 20 21 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 19 def assert_is_empty(enumerable:, error_message:) assert_has_size(enumerable:, size: 0, error_message:) end |
#assert_is_equal(expected:, actual:, error_message:) ⇒ Object
3 4 5 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 3 def assert_is_equal(expected:, actual:, error_message:) assert_equal(expected, actual, ) end |
#assert_not_blank(string:, error_message:) ⇒ Object
23 24 25 26 |
# File 'lib/govuk_ab_testing/minitest_assertions.rb', line 23 def assert_not_blank(string:, error_message:) refute_nil(string, ) refute_equal(string.length, 0, ) end |