class Gurke::Feature

Attributes

backgrounds[R]

List of backgrounds this feature specifies.

@return [Array<Background>] Backgrounds.

file[R]

Return path to file containing this feature.

@return [String] File path.

line[R]

Return line number where this feature is defined.

@return [Fixnum] Line number.

raw[R]

@api private

scenarios[R]

List of scenarios this feature specifies.

@return [Array<Scenario>] Scenarios.

tags[R]

Public Class Methods

new(file, line, tags, raw) click to toggle source

@api private

# File lib/gurke/feature.rb, line 36
def initialize(file, line, tags, raw)
  @scenarios   = RunList.new
  @backgrounds = RunList.new

  @file = file
  @line = line
  @tags = tags
  @raw  = raw
end
new(*args) click to toggle source
Calls superclass method
# File lib/gurke/feature.rb, line 66
def self.new(*args)
  if args.size == 1 && (f = args.first).is_a?(self)
    super f.file, f.line, f.tags, f.raw
  else
    super
  end
end

Public Instance Methods

description() click to toggle source
# File lib/gurke/feature.rb, line 54
def description
  raw.description
end
failed?() click to toggle source
# File lib/gurke/feature.rb, line 58
def failed?
  scenarios.any?(&:failed?)
end
name() click to toggle source

Return name of this feature.

@return [String] Feature name.

# File lib/gurke/feature.rb, line 50
def name
  raw.name
end
pending?() click to toggle source
# File lib/gurke/feature.rb, line 62
def pending?
  scenarios.any?(&:pending?)
end
run(runner, reporter) click to toggle source

@api private

# File lib/gurke/feature.rb, line 77
def run(runner, reporter)
  reporter.invoke :before_feature, self

  runner.hook :feature, self, nil do
    run_feature runner, reporter
  end
ensure
  reporter.invoke :after_feature, self
end

Private Instance Methods

run_feature(runner, reporter) click to toggle source
# File lib/gurke/feature.rb, line 89
def run_feature(runner, reporter)
  reporter.invoke :start_feature, self

  scenarios.run runner, reporter
ensure
  reporter.invoke :end_feature, self
end