Cucumber helper to run rake tasks in the current process, capturing properties to assert tests against
Add this line to your application's Gemfile:
gem 'cucumber_rake_runner', require: false
And then execute:
Or install it yourself as:
$ gem install cucumber_rake_runner
Add the following line to your cucumber environment file typically found at
Sometimes there is a need to test your rake tasks. Typically this is done by a system call such as
@output = `rake some:amazing:task`
Sometimes this is desirable, at other times, in particular when using Jruby it is not. For each execution of the above a new JVM must spin up costing significant delays to test turnaround time.
The solution is to run the task inline to the cucumber process via Rake's invoke command. This gem provides a handy dandy solution to get the above functionality and more while running the rake task inline to the current process.
Simply incorportate the following call appropriately in your step definitions
@rake_output = run_rake_task(task_name, arg1, arg2, ... )
This will run the rake tasks with the specified parameters. If the rake task does not take parameters only the task_name is required.
The returned obect from this call is an OpenStruct with the following properties
- stdout - All output generated by the task sent to stdout
- stderr - All output generated by the task sent to stderr
- time - Time taken to execute rake task.
@rake_output.stdout.include? 'Some expected output from task'
See the features and step definitions in this gem for example usage.
Tests can be run via
There are rake task definitions that the tests depend on. Please feel free to expand.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request