Module: Cucover

Defined in:
lib/cucover.rb,
lib/cucover/cli.rb,
lib/cucover/rails.rb,
lib/cucover/store.rb,
lib/cucover/monkey.rb,
lib/cucover/recorder.rb,
lib/cucover/recording.rb,
lib/cucover/controller.rb,
lib/cucover/line_numbers.rb,
lib/cucover/cucumber_hooks.rb,
lib/cucover/cucumber_hooks.rb,
lib/cucover/cli_commands/version.rb,
lib/cucover/cli_commands/cucumber.rb,
lib/cucover/recording/covered_file.rb,
lib/cucover/cli_commands/coverage_of.rb,
lib/cucover/cli_commands/show_recordings.rb

Defined Under Namespace

Modules: CliCommands, ExampleRowExtensions, FeatureElementExtensions, LineNumbers, Monkey, Rails Classes: Cli, Controller, Recorder, Recording, Store

Class Method Summary collapse

Class Method Details

.loggerObject



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

def logger
  Logging::Logger['Cucover']
end

.record_file(source_file) ⇒ Object



46
47
48
49
# File 'lib/cucover.rb', line 46

def record_file(source_file)
  Cucover.logger.debug("Recording extra source file #{source_file}")
  @current_recorder.record_file!(source_file)
end

.should_execute?(scenario_or_table_row) ⇒ Boolean

Returns:

  • (Boolean)


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

def should_execute?(scenario_or_table_row)
  controller(scenario_or_table_row).should_execute?
end

.start_recording!(scenario_or_table_row) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/cucover.rb', line 30

def start_recording!(scenario_or_table_row)
  raise("Already recording. Please call stop first.") if recording?

  @current_recorder = Recorder.new(scenario_or_table_row)
  @current_recorder.start!
  record_file(scenario_or_table_row.file_colon_line.split(':').first) # TODO: clean this by extending the feature element
end

.stop_recording!Object



38
39
40
41
42
43
44
# File 'lib/cucover.rb', line 38

def stop_recording!
  return unless recording?

  @current_recorder.stop!
  store.keep!(@current_recorder.recording)
  @current_recorder = nil
end