Sha256: a1af1f6d86fd31f6ba5daa0e2f6a15f8fb60bc8233764f0321d5805f67bc1c4b

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

class ScreenshotMaker
  attr_accessor :basedir

  def initialize basedir
    @basedir = basedir
  end

  def make page, options
    page.save_screenshot(screenshot_path(options))
  end

  def screenshot_path options
    File.expand_path("#{basedir}/#{screenshot_name(options)}")
  end

  def screenshot_name options
    filename = File.basename(options[:file_path])
    line_number = options[:line_number]

    name = filename
    name += "-#{line_number}" if line_number

    "#{name}.png"
  end

  def screenshot_url options
    "file:///#{screenshot_path(options)}"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acceptance_test-1.7.11 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.7.9 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.7.8 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.7.7 lib/acceptance_test/screenshot_maker.rb