Sha256: 8f9f19fab19a59fc5c87c1d9e123d3ad7bd9b2c999ddfe7d2d61f7ee9ade07ff
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module Cucumber module Formatter module SpecHelperDsl attr_reader :feature_content, :step_defs, :feature_filename def define_feature(string, feature_file = 'spec.feature') @feature_content = string @feature_filename = feature_file end def define_steps(&block) @step_defs = block end end require 'cucumber/core' module SpecHelper include Core def run_defined_feature define_steps runtime.visitor = report execute [gherkin_doc], mappings, report end require 'cucumber/mappings' def mappings @mappings ||= Mappings.new end require 'cucumber/formatter/legacy_api/adapter' def report @report ||= LegacyApi::Adapter.new( Fanout.new([@formatter]), runtime.results, runtime.support_code, runtime.configuration) end require 'cucumber/core/gherkin/document' def gherkin_doc Core::Gherkin::Document.new(self.class.feature_filename, gherkin) end def gherkin self.class.feature_content || raise("No feature content defined!") end def runtime mappings.runtime end def define_steps return unless step_defs = self.class.step_defs rb = runtime.load_programming_language('rb') dsl = Object.new dsl.extend RbSupport::RbDsl dsl.instance_exec &step_defs end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cucumber-2.0.0.beta.5 | spec/cucumber/formatter/spec_helper.rb |
cucumber-2.0.0.beta.4 | spec/cucumber/formatter/spec_helper.rb |