Sha256: c7a5578e486b2c668b9009784a10fa9edca0af1e09014e3e5da5646802a65fa6

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

require 'rubygems'
require 'RMagick'

# include this module in your spec and call +save_screenshot+ and +save_source+ from
# teardown.
module WebTestHtmlFormatterHelper
  if RUBY_PLATFORM =~ /darwin/
    require File.dirname(__FILE__) + '/web_test_html_formatter_osx_helper'
    include WebTestHtmlFormatterOsxHelper
    Watir::Browser = Watir::Safari
  else
    require File.dirname(__FILE__) + '/web_test_html_formatter_win_helper'
    include WebTestHtmlFormatterWinHelper
    Watir::Browser = Watir::IE
  end

  def save_thumb(img, dir, spec_number)
    thumb = img.scale(0.25)
    thumb_file = "#{dir}/#{spec_number}_thumb.png"
    thumb.write(thumb_file)
  end

  def save_source(dir, spec_number, html)
    File.open("#{dir}/#{spec_number}.html", "w") {|io| io.write(html)}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-0.7.4 vendor/web_spec/web_test_html_formatter_helper.rb
rspec-0.7.5 ../web_spec/web_test_html_formatter_helper.rb