Sha256: 974c836149f452342b0452a6656988d3fb12f08fb240703190232c4f056605a7
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Cucumber module Formatter module SpecHelperDsl attr_reader :feature_content, :step_defs def define_feature(string) @feature_content = string end def define_steps(&block) @step_defs = block end end module SpecHelper def run_defined_feature define_steps features = load_features(self.class.feature_content || raise("No feature content defined!")) run(features) end def step_mother @step_mother ||= StepMother.new end def load_features(content) feature_file = FeatureFile.new('spec.feature', content) features = Ast::Features.new feature = feature_file.parse(options, {}) features.add_feature(feature) if feature features end def run(features) tree_walker = Cucumber::Ast::TreeWalker.new(@step_mother, [@formatter], options, STDOUT) tree_walker.visit_features(features) end def define_steps return unless step_defs = self.class.step_defs rb = @step_mother.load_programming_language('rb') dsl = Object.new dsl.extend RbSupport::RbDsl dsl.instance_exec &step_defs end def options @options ||= mock(Cucumber::Cli::Options, :filters => [], :[] => nil) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cucumber-0.8.7 | spec/cucumber/formatter/spec_helper.rb |
cucumber-0.8.5 | spec/cucumber/formatter/spec_helper.rb |
cucumber-0.8.4 | spec/cucumber/formatter/spec_helper.rb |