Sha256: b949909b832a3bf364792d53e465d58c616299a461ef56630e5ada48359f4b2b

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

require 'visdiff/test_run'

require 'rspec/core'

module Visdiff::RSpec
  def observe!(identifier)
    visdiff.observe_page(identifier, page)
  end

  def visdiff
    RSpec.configuration.visdiff
  end
end

RSpec.configure do |c|
  visdiff = Visdiff::TestRun.new

  c.add_setting :visdiff
  c.visdiff = visdiff

  c.after(:each) do |example|
    if example.exception && visdiff.enabled
      warn "Disabling visdiff due to test failure"
      visdiff.enabled = false
    end
  end

  c.after(:suite) do
    visdiff.submit!
  end

  c.include Visdiff::RSpec
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
visdiff-0.0.7 lib/visdiff/rspec.rb
visdiff-0.0.6 lib/visdiff/rspec.rb