Class: Skewer::Cuke

Inherits:
Object
  • Object
show all
Includes:
Skewer
Defined in:
lib/cuke.rb

Overview

Runs the Cucumber features for a given directory.

Specifically, the tests related to infrastructure that skewer will map against to check if the node has been successfully built.

Defined Under Namespace

Classes: CukeError

Constant Summary

Constants included from Skewer

VERSION

Instance Method Summary collapse

Methods included from Skewer

logger, logger=

Constructor Details

#initialize(dir = nil, host = nil) ⇒ Cuke

Returns a new instance of Cuke.



11
12
13
14
15
# File 'lib/cuke.rb', line 11

def initialize(dir = nil, host = nil)
  raise "you must provide a valid directory for features to be executed within" unless File.directory?(dir)
  @dir = dir
  @host = host
end

Instance Method Details

#runObject

Raises:



17
18
19
20
21
22
23
24
# File 'lib/cuke.rb', line 17

def run
  Skewer.logger.debug("Running cucumber hook")
  `cd #{@dir}/.. && bundle install` if File.join(@dir, '..', 'Gemfile')
  result = `cucumber #{@dir} SKEWER_HOST=#{@host}`
  parsed = result.match(/failed/)[0] rescue false
  raise CukeError, "One of the cuke features failed!\n\n#{result}" if parsed
  result
end