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.



36
37
38
39
40
41
42
43
44
# 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

Instance Attribute Details

#backgroundsArray<Background> (readonly)

List of backgrounds this feature specifies.

Returns:



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

def backgrounds
  @backgrounds
end

#fileString (readonly)

Return path to file containing this feature.

Returns:

  • (String)

    File path.



10
11
12
# File 'lib/gurke/feature.rb', line 10

def file
  @file
end

#lineFixnum (readonly)

Return line number where this feature is defined.

Returns:

  • (Fixnum)

    Line number.



16
17
18
# File 'lib/gurke/feature.rb', line 16

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.



33
34
35
# File 'lib/gurke/feature.rb', line 33

def raw
  @raw
end

#scenariosArray<Scenario> (readonly)

List of scenarios this feature specifies.

Returns:



22
23
24
# File 'lib/gurke/feature.rb', line 22

def scenarios
  @scenarios
end

#tagsObject (readonly)

Returns the value of attribute tags.



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

def tags
  @tags
end

Class Method Details

.new(*args) ⇒ Object



66
67
68
69
70
71
72
# 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

Instance Method Details

#descriptionObject



54
55
56
# File 'lib/gurke/feature.rb', line 54

def description
  raw.description
end

#failed?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/gurke/feature.rb', line 58

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

#nameString

Return name of this feature.

Returns:

  • (String)

    Feature name.



50
51
52
# File 'lib/gurke/feature.rb', line 50

def name
  raw.name
end

#pending?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/gurke/feature.rb', line 62

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.



77
78
79
80
81
82
83
84
85
# 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