class React::Test::Matchers::RenderHTMLMatcher
Public Class Methods
new(expected)
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 5 def initialize(expected) @expected = expected @params = {} end
Public Instance Methods
failure_message()
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 21 def failure_message failure_string end
matches?(component)
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 15 def matches?(component) @component = component @actual = render_to_html @expected == @actual end
negative_failure_message()
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 25 def negative_failure_message failure_string(:negative) end
with_params(params)
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 10 def with_params(params) @params = params self end
Private Instance Methods
failure_string(negative = false)
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 36 def failure_string(negative = false) str = "expected '#{@component.name}' with params '#{@params}' to " str = str + "not " if negative str = str + "render '#{@expected}', but '#{@actual}' was rendered." str end
render_to_html()
click to toggle source
# File lib/react/test/matchers/render_html_matcher.rb, line 31 def render_to_html element = React.create_element(@component, @params) React.render_to_static_markup(element) end