Module: Dommy::Rails::DomSource

Included in:
Minitest::Integration, RSpec::Integration
Defined in:
lib/dommy/rails/dom_source.rb

Overview

Shared implementation of the ‘dom` helper for the Minitest and RSpec integration modules: locates the HTML source on the test context (response / rendered / mail) and memoizes the parsed document per source string.

Instance Method Summary collapse

Instance Method Details

#domObject



12
13
14
15
16
17
18
# File 'lib/dommy/rails/dom_source.rb', line 12

def dom
  source = dom_html_source.to_s
  return @dommy_rails_dom if defined?(@dommy_rails_dom_source) && @dommy_rails_dom_source == source

  @dommy_rails_dom_source = source
  @dommy_rails_dom = Dommy.parse(source).document
end