Module: ROM::Lint::Test

Included in:
TestEnumerableDataset, TestGateway
Defined in:
lib/rom/lint/test.rb

Overview

A module that helps to define test methods

Instance Method Summary collapse

Instance Method Details

#define_test_method(name, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Defines a test method converting lint failures to assertions

Parameters:

  • name (String)

15
16
17
18
19
20
21
22
23
# File 'lib/rom/lint/test.rb', line 15

def define_test_method(name, &block)
  define_method "test_#{name}" do
    begin
      instance_eval(&block)
    rescue ROM::Lint::Linter::Failure => e
      raise Minitest::Assertion, e.message
    end
  end
end