Class: Crab::CucumberScenario

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/crab/cucumber_scenario.rb

Instance Method Summary collapse

Methods included from Utilities

#add_or_update_options, #credentials_file, #current_project_name, #dotcrab_file, #sanitize, #sanitize_options, #state_after, #state_before, #state_from, #valid_credentials_file, #valid_project_name

Methods included from Logging

#logger

Constructor Details

#initialize(language) ⇒ CucumberScenario

Returns a new instance of CucumberScenario.



6
7
8
9
# File 'lib/crab/cucumber_scenario.rb', line 6

def initialize(language)
  @language = Gherkin::I18n.new(language)
  @adapter = Crab::RallyToCucumberAdapter.new @language
end

Instance Method Details

#generate_from(test_case) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/crab/cucumber_scenario.rb', line 11

def generate_from(test_case)
  text = StringIO.new
  formatter = Gherkin::Formatter::PrettyFormatter.new(text, true, false)

  formatter.scenario @adapter.scenario_from(test_case)
  @adapter.steps_from(test_case).each do |step|
    formatter.step step
  end
  formatter.eof

  text.string.strip
end