In chefspec is it possible to write a method once and call that method in other spec files?

38 views Asked by At

I am trying to write a method test_run(first_param,second_param) in one spec file program_spec.rb and I want to call this method test_run in another spec file second_program_spec.rb. How do I call the method which is declared in program_spec.rb to be used in another spec file ?

1

There are 1 answers

0
Psyreactor On BEST ANSWER

you can create a helper_spec.rb and include it in the required specfiles. I attach a link to the documentation examples.

https://relishapp.com/rspec/rspec-core/v/3-9/docs/helper-methods/define-helper-methods-in-a-module#include-a-module-in-only-some- example-groups

Best Regards.