Rspec::CommandOption
It is option command builder of 'rspec' for RSpec::Core::RakeTask#rspec_opts
Installation
Add this line to your application's Gemfile:
gem 'rspec-command_option'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-command_option
Usage
The simplest examples
require 'rspec/command_option'
option_example1 = RSpec::CommandOption.new do |opt|
opt.dry_run = true
opt.color = true
opt.tag = "~speed:slow"
end
puts option_example1.build #=> '--dry-run --color --tag=\~speed:slow'
require 'rspec/command_option'
option_example2 = RSpec::CommandOption.new
option_example2.dry_run = true
option_example2.format = 'documentation'
puts option_example2.build #=> '--dry-run --format=documentation'
With RSpec::Core::RakeTask
require 'rspec/core/rake_task'
require 'rspec/command_option'
rspec_opt = RSpec::CommandOption.new do |opt|
opt.dry_run = true
opt.color = true
opt.tag = "~speed:slow"
end
# If you execute this rake command, will execute 'rspec' command with '--dry-run --color --tag=\~speed:slow'
desc "Run examples"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = rspec_opts
end
Contributing
- Fork it ( https://github.com/[my-github-username]/rspec-command_option/fork )
- 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 a new Pull Request