Sha256: 23e323b7c41a493d26506adfde24ec126c4ac859e88c749ece59150c37d5f2b5

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

module CukeTest
	module Helpers
		# Runs the feature file (and optionally just one scenario therein) through Cucumber.
		# Returns Cucumber's output as a string.
		def feature(feature_file, scenario = nil)
			out = StringIO.new
			errors = StringIO.new
			if features_path = CukeTest.config.features_path
				feature_file = File.join(features_path, feature_file)
			end
			cli_args = [feature_file, '--no-color']
			if scenario
				cli_args += ['--name', '"' + scenario + '"']
			end
			`cucumber #{cli_args.join(' ')}` # This works
		end
		
		# Runs the one scenario in the feature file through Cucumber.
		# Returns Cucumber's output as a string.
		def scenario(feature_file, scenario)
			feature(feature_file, scenario)
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuke-test-0.0.1 lib/cuke-test/helpers.rb