Sha256: f1ea32676aa13a97694289b9f504dbe00c70b5b5cd924e7525c5daed9ff934cb

Contents?: true

Size: 599 Bytes

Versions: 18

Compression:

Stored size: 599 Bytes

Contents

class ScreenshotMaker
  attr_reader :basedir

  def initialize basedir
    @basedir = File.expand_path(basedir.to_s)
  end

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

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

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

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

    "#{name}.png"
  end

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

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
acceptance_test-1.5.3 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.5.2 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.5.1 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.5.0 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.9 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.8 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.7 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.6 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.5 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.4 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.3 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.2 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.1 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.4.0 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.3.1 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.3.0 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.2.0 lib/acceptance_test/screenshot_maker.rb
acceptance_test-1.1.5 lib/acceptance_test/screenshot_maker.rb