def step_I_run_the_feature_with_the_formatter(context, formatter): # When /^I run the feature with the (\w+) formatter$/ do |formatter| # features.length.should == 1 # run_feature features.first, formatter # end command_util.ensure_workdir_exists(context) command_util.ensure_context_resource_exists(context, "features", []) command = "behave --format={0} {1}".format(formatter, context.features[0]) context.command_result = command_shell.run(command, cwd=context.workdir)
def step_a_scenario_with_a_step_that_looks_like_this(context): # Given /^a scenario with a step that looks like this:$/ do |string| # create_feature do # create_scenario { string } # end # end command_util.ensure_workdir_exists(context) scenario_text = context.text filename = behave_builder.create_scenario(scenario_text, cwd=context.workdir) command_util.ensure_context_resource_exists(context, "features", []) context.features.append(filename)
def step_a_file_named_filename_with(context, filename): """ Creates a textual file with the content provided as docstring. """ assert context.text is not None, "ENSURE: multiline text is provided." assert not os.path.isabs(filename) command_util.ensure_workdir_exists(context) filename2 = os.path.join(context.workdir, filename) command_util.create_textfile_with_contents(filename2, context.text) # -- SPECIAL CASE: For usage with behave steps. if filename.endswith(".feature"): command_util.ensure_context_resource_exists(context, "features", []) context.features.append(filename)