Class: Azebiki::Checker::MatcherProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/azebiki/azebiki.rb

Instance Method Summary collapse

Constructor Details

#initialize(have_matcher) ⇒ MatcherProxy

Returns a new instance of MatcherProxy.



110
111
112
113
# File 'lib/azebiki/azebiki.rb', line 110

def initialize(have_matcher)
  @have_matcher = have_matcher
  @failure_message = "Content should have included #{content_message}, but did not"
end

Instance Method Details

#content_messageObject



119
120
121
122
123
124
125
# File 'lib/azebiki/azebiki.rb', line 119

def content_message
  if @have_matcher.respond_to?(:tag_inspect)
    @have_matcher.tag_inspect
  else
    @have_matcher.content_message
  end
end

#failure_message(new_failure_message) ⇒ Object



115
116
117
# File 'lib/azebiki/azebiki.rb', line 115

def failure_message(new_failure_message)
  @failure_message = new_failure_message.gsub(/:tag/, content_message)
end

#matches?(content) ⇒ Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/azebiki/azebiki.rb', line 127

def matches?(content)
  @have_matcher.matches?(content)
end

#messageObject



131
132
133
# File 'lib/azebiki/azebiki.rb', line 131

def message
  @failure_message
end