How to use spaces in function names in Cucumber

I am using Windows and trying to run an existing package of functions that was originally built on Mac OS, which allows them to work around the problem with " \ " with spaces.

I am using Ruby 2.2.3 and Cucumber.

Function names contain spaces, and I cannot change this. I tried using " " and ' ' to get around the white spaces, but each time having the same problem.

Here is an example of a problem. If I run:

 cucumber features/'Name containing whitespaces.feature' 

It works fine.

But when I run:

 cucumber -p my_profile 

and cucumber.yml contains:

 my_profile: features/'Name containing whitespaces.feature' 

Then it fails with:

 No such file or directory - features/'Name. You can use `cucumber --init` to get started. 

Can someone help me get around this problem, since renaming in my case is not an option.

+6
source share
1 answer

You can test certain functions using the Cucumber @ tags. I like to use @wip, which stands for work. For example

In login.feature

 Feature: Log in @wip Scenario: Successful Login Given I do some things Then I should be logged in 

Then in the terminal you run

 cucumber --tags @wip 

and he will run tests only for this scenario or function.

This will allow you to test certain functions or scripts in a cucumber without worrying about spaces in the names.

0
source

All Articles