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.



141
142
143
144
# File 'lib/azebiki/azebiki.rb', line 141

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



150
151
152
153
154
155
156
# File 'lib/azebiki/azebiki.rb', line 150

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



146
147
148
# File 'lib/azebiki/azebiki.rb', line 146

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

#matches?(content) ⇒ Boolean

Returns:

  • (Boolean)


158
159
160
# File 'lib/azebiki/azebiki.rb', line 158

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

#messageObject



162
163
164
# File 'lib/azebiki/azebiki.rb', line 162

def message
  @failure_message
end