Class: Gurke::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/feature.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line, tags, raw) ⇒ Feature

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Feature.



34
35
36
37
38
39
40
41
42
# File 'lib/gurke/feature.rb', line 34

def initialize(file, line, tags, raw)
  @scenarios   = RunList.new
  @backgrounds = RunList.new

  @file = file
  @line = line
  @tags = tags
  @raw  = raw
end

Instance Attribute Details

#backgroundsArray<Background> (readonly)

List of backgrounds this feature specifies.

Returns:



26
27
28
# File 'lib/gurke/feature.rb', line 26

def backgrounds
  @backgrounds
end

#fileString (readonly)

Return path to file containing this feature.

Returns:

  • (String)

    File path.



8
9
10
# File 'lib/gurke/feature.rb', line 8

def file
  @file
end

#lineFixnum (readonly)

Return line number where this feature is defined.

Returns:

  • (Fixnum)

    Line number.



14
15
16
# File 'lib/gurke/feature.rb', line 14

def line
  @line
end

#rawObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/gurke/feature.rb', line 31

def raw
  @raw
end

#scenariosArray<Scenario> (readonly)

List of scenarios this feature specifies.

Returns:



20
21
22
# File 'lib/gurke/feature.rb', line 20

def scenarios
  @scenarios
end

#tagsObject (readonly)

Returns the value of attribute tags.



28
29
30
# File 'lib/gurke/feature.rb', line 28

def tags
  @tags
end

Class Method Details

.new(*args) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/gurke/feature.rb', line 68

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

Instance Method Details

#descriptionObject



48
49
50
# File 'lib/gurke/feature.rb', line 48

def description
  raw.description
end

#failed?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/gurke/feature.rb', line 60

def failed?
  scenarios.any?(&:failed?)
end

#nameString

Return name of this feature.

Returns:

  • (String)

    Feature name.



56
57
58
# File 'lib/gurke/feature.rb', line 56

def name
  raw.name
end

#pending?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/gurke/feature.rb', line 64

def pending?
  scenarios.any?(&:pending?)
end

#run(runner, reporter) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



79
80
81
82
83
84
85
86
87
# File 'lib/gurke/feature.rb', line 79

def run(runner, reporter)
  reporter.invoke :before_feature, self

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