Support simple parameterized test syntax in rspec.
describe "plus" do
where(:a, :b, :answer) do
[
[1 , 2 , 3],
[5 , 8 , 13],
[0 , 0 , 0]
]
end
with_them do
it "should do additions" do
(a + b).should == answer
end
end
end
I was inspired by udzura's mock.
Add this line to your application's Gemfile:
gem 'rspec-parameterized'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-parameterized
Require rspec-parameterized
from your spec_helper.rb
.
require 'rspec-parameterized'
Follow the sample spec above.
Arguments given to with_them
is directly passed to describe
. You can specify :pending
, :focus
, etc. here.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request