Module: Spinach::FeatureSteps::Capybara

Includes:
Capybara::DSL, Capybara::RSpecMatchers
Defined in:
lib/spinach/capybara.rb

Overview

Spinach's capybara module makes Capybara DSL available in all features.

Examples:

require 'spinach/capybara'
class CapybaraFeature < Spinach::FeatureSteps
  Given "I go to the home page" do
    visit '/'
  end
end

Instance Method Summary (collapse)

Instance Method Details

- (Object) capybara_visit



28
# File 'lib/spinach/capybara.rb', line 28

alias_method :capybara_visit, :visit

- (Object) null_device



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/spinach/capybara.rb', line 40

def null_device
  return @null_device if defined?(@null_device)

  if RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
    @null_device = "NUL"
  else
    @null_device = "/dev/null"
  end

  @null_device
end

- (Object) visit(*args)



30
31
32
33
34
35
36
37
38
# File 'lib/spinach/capybara.rb', line 30

def visit(*args)
  stream = STDOUT
  old_stream = stream.dup
  stream.reopen(null_device)
  stream.sync = true
  capybara_visit *args
ensure
  stream.reopen(old_stream)
end