Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
RSpec::Parameterized supports simple parameterized test syntax in rspec.
Ruby
Branch: master

Merge pull request #21 from JunichiIto/update-readme

Update README to use expect syntax.
latest commit 115e9d5f47
@joker1007 joker1007 authored
Failed to load latest commit information.
gemfiles Add rspec3.2.gemfile
lib Version 0.1.3
spec Accept 1st nil or boolean type.
.gitignore Add test tasks & multi rspec version gemfile
.rspec
.travis.yml Add "sudo: false" to .travis.yml
Gemfile Initialize the project
LICENSE Initialize the project
README.md Update README to use expect syntax.
Rakefile Add rspec3.2.gemfile
rspec-parameterized.gemspec Remove trailing '>' character from TableSyntax

README.md

RSpec::Parameterized Build Status

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
      expect(a + b).to eq answer
    end
  end
end

describe "plus" do
  using RSpec::Parameterized::TableSyntax

  where(:a, :b, :answer) do
    1 | 2 | 3
    5 | 8 | 13
    0 | 0 | 0
  end

  with_them do
    it "should do additions" do
      expect(a + b).to eq answer
    end
  end
end

I was inspired by udzura's mock.

Installation

Add this line to your application's Gemfile:

gem 'rspec-parameterized'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-parameterized

Usage

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.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.