A protective file to run one function of a cucumber in a subdirectory?

I have my functions organized in subfolders, for example:

app/ features/ users/ feature1.feature feature2.feature 

But every time I save a function, Guard performs all my functions (and not just the one that was edited). How can I change it to run only the one that has been saved?

Here is my Guardfile for the cucumber:

 guard 'cucumber', :cli => "--drb --require features/support --require features/step_definitions" do watch(%r{features/.+\.feature}) watch(%r{features/support/.+}) { 'features' } watch(%r{features/step_definitions/(.+)_steps\.rb}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } end 
+6
source share
2 answers

Aph, the answer was directly in the documentation :

It is very important that you understand how the cucumber gets, since often the origin of the strange behavior is the cucumber guard.

Cucumber uses cucumber.yml to determine the profiles for a particular configuration run. When you go through the configuration through the: cli option but do not include a specific profile with -profile, then the default configuration is the profile.

For example, when you use the default cucumber.yml generated cucumber rails, then by default profiles the cucumber guard before always run all the functions, because this adds a folder with functions.

Set up a cucumber solely out of fear

If you want to configure Cucumber from Security exclusively, then you must go through the --no-profile to the option: cli.

So, going to --no-profile for the parameter :cli now works, and I get normal behavior.

Call me for not reading the documents!

+4
source

The --no-profile flag is no longer needed, in addition, it does not display information about the launch functions in the console (for example, code fragments for steps not yet completed), which is definitely not what you want.

Today, it seems you need to use the flag :all_after_pass , like this (in your Guard file):

 guard 'cucumber', :cli => '--drb', :all_on_start => false, :all_after_pass => false do 

Hope this helps.

+1
source

Source: https://habr.com/ru/post/888666/


All Articles