Module: Trailblazer::Test

Defined in:
lib/trailblazer/test.rb,
lib/trailblazer/test/version.rb,
lib/trailblazer/test/assertions.rb,
lib/trailblazer/test/deprecation/operation/helper.rb,
lib/trailblazer/test/deprecation/operation/assertions.rb

Defined Under Namespace

Modules: Assertions, Deprecation, Operation

Constant Summary collapse

VERSION =
"0.1.1".freeze

Class Method Summary collapse

Class Method Details

.actual(asserted, reader, name) ⇒ Object

Read the actual value from the asserted object (e.g. a model).



11
12
13
# File 'lib/trailblazer/test/assertions.rb', line 11

def self.actual(asserted, reader, name)
  reader ? asserted.public_send(reader, name) : asserted.public_send(name)
end

.expected(asserted, value, actual) ⇒ Object

Evaluate value if it’s a lambda, and let the caller know whether we need an assert_equal or an assert.



6
7
8
# File 'lib/trailblazer/test/assertions.rb', line 6

def self.expected(asserted, value, actual)
  value.is_a?(Proc) ? [value.(actual: actual, asserted: asserted), false] : [value, true]
end