Class: Templater::Spec::Helpers::CreateMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/templater/spec/helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ CreateMatcher

Returns a new instance of CreateMatcher.



42
43
44
# File 'lib/templater/spec/helpers.rb', line 42

def initialize(expected)
  @expected = expected
end

Instance Method Details

#failure_messageObject



52
53
54
# File 'lib/templater/spec/helpers.rb', line 52

def failure_message
  "expected #{@actual.inspect} to create #{@expected.inspect}, but it didn't"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
# File 'lib/templater/spec/helpers.rb', line 46

def matches?(actual)
  @actual = actual
  # Satisfy expectation here. Return false or raise an error if it's not met.
  @actual.all_actions.map{|t| t.destination }.include?(@expected)
end

#negative_failure_messageObject



56
57
58
# File 'lib/templater/spec/helpers.rb', line 56

def negative_failure_message
  "expected #{@actual.inspect} not to create #{@expected.inspect}, but it did"
end