Class: FeatureBehavior::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_behavior/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description, example = nil, no_skip = true, &block) ⇒ Runner

Returns a new instance of Runner.



10
11
12
13
14
15
# File 'lib/feature_behavior/runner.rb', line 10

def initialize(description, example = nil, no_skip = true, &block)
  @description = description
  @example = example
  @example_block = block
  @skipped = !no_skip
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/feature_behavior/runner.rb', line 8

def description
  @description
end

#exampleObject (readonly)

Returns the value of attribute example.



8
9
10
# File 'lib/feature_behavior/runner.rb', line 8

def example
  @example
end

#example_blockObject (readonly)

Returns the value of attribute example_block.



8
9
10
# File 'lib/feature_behavior/runner.rb', line 8

def example_block
  @example_block
end

#skippedObject (readonly)

Returns the value of attribute skipped.



8
9
10
# File 'lib/feature_behavior/runner.rb', line 8

def skipped
  @skipped
end

Class Method Details

.run(description, example = nil, no_skip = true, &block) ⇒ Object



4
5
6
# File 'lib/feature_behavior/runner.rb', line 4

def self.run(description, example = nil, no_skip = true, &block)
  new(description, example, no_skip, &block).run
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/feature_behavior/runner.rb', line 17

def run
  before_behavior
  notify :behavior_started

  if skipped
    reporter.notify :behavior_skipped, skipped_behavior_args
  else
    run_example!
    notify :behavior_passed
  end

  notify :behavior_terminated
  after_behavior
end