Class: Crab::CucumberFeature
- Inherits:
-
Object
- Object
- Crab::CucumberFeature
- Includes:
- Utilities
- Defined in:
- lib/crab/cucumber_feature.rb
Instance Method Summary collapse
- #generate_from(story, include_testcases) ⇒ Object
-
#initialize(language) ⇒ CucumberFeature
constructor
A new instance of CucumberFeature.
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
Constructor Details
#initialize(language) ⇒ CucumberFeature
Returns a new instance of CucumberFeature.
7 8 9 10 |
# File 'lib/crab/cucumber_feature.rb', line 7 def initialize(language) @language = Gherkin::I18n.new(language) @adapter = Crab::RallyToCucumberAdapter.new @language end |
Instance Method Details
#generate_from(story, include_testcases) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/crab/cucumber_feature.rb', line 12 def generate_from(story, include_testcases) text = StringIO.new formatter = Gherkin::Formatter::PrettyFormatter.new(text, true, false) feature = @adapter.feature_from story formatter.feature feature if include_testcases Array(story.test_cases).tap {|tcs| logger.info "#{story.formatted_id}: #{tcs.size} test case(s) found" }.each do |test_case| formatter.scenario @adapter.scenario_from(test_case) @adapter.steps_from(test_case).each do |step| formatter.step step end end end formatter.eof text.string.strip end |