Module: Juxtapose

Included in:
Capybara::Session
Defined in:
lib/juxtapose/version.rb,
lib/juxtapose/screenshotter.rb,
lib/juxtapose/strategy/frank_strategy.rb,
lib/juxtapose/strategy/appium_strategy.rb,
lib/juxtapose/strategy/capybara_strategy.rb,
lib/juxtapose/strategy/mac_bacon_strategy.rb

Defined Under Namespace

Classes: AppiumStrategy, CapybaraStrategy, FrankStrategy, MacBaconStrategy, Screenshotter

Constant Summary collapse

VERSION =
"0.3.2"
MAX_ATTEMPTS =
20

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/juxtapose/screenshotter.rb', line 2

def self.extended(base)
  if defined?(::Bacon::Specification)
    ::Bacon::Specification.class_eval do
      @@juxtapatched ||= nil

      unless @@juxtapatched
        alias_method :original_run_spec_block, :run_spec_block
        @@juxtapatched = true

        def run_spec_block
          Thread.current["CURRENT_SPEC_DESCRIPTION"] = @description
          original_run_spec_block
        end
      end
    end
  end
end

Instance Method Details

#it_should_look_like(template, fuzz_factor = 0) ⇒ Object



26
27
28
# File 'lib/juxtapose/screenshotter.rb', line 26

def it_should_look_like(template, fuzz_factor = 0)
  looks_like?(template, fuzz_factor).should.be.true
end

#looks_like?(template, fuzz_factor = 0) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/juxtapose/screenshotter.rb', line 22

def looks_like?(template, fuzz_factor=0)
  Screenshotter.new(self, template, fuzz_factor).attempt_verify(MAX_ATTEMPTS)
end