Module: Capybara::Differ
- Defined in:
- lib/capybara-differ.rb,
lib/capybara-differ/version.rb
Defined Under Namespace
Classes: Comparator
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#check_page(name, options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/capybara-differ.rb', line 48 def check_page(name, = {}) filename = File.join(name, Time.now.strftime('%Y%m%d%H%M%S') + '.html') save_page(filename) base_dir = File.join([Capybara.save_path, name].compact) old_html_path = Dir[File.join(base_dir, '*')].first new_html_path = Dir[File.join(base_dir, '*')].last comparator = Capybara::Differ::Comparator.new(old_html_path, new_html_path, ) if (result = comparator.compare).strip.size > 0 puts result else puts "No difference on '#{name}' snapshots" end end |