Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Testing methods with multiple arguments much easier

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 its.gemspec
README.md

"Its" makes testing methods with multiple arguments much easier

Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, Rubinius (1.8 and 1.9) and JRuby Build Status

Have you ever written something like this in your specs?

it "should be US currency" do
  subject.currency(:us).should == 'US dollar'
end

it "should be AU currency" do
  subject.currency(:au).should == 'AU dollar'
end

it "should be UK currency" do
  subject.currency(:uk).should == 'UK pound'
end

If yes, then this is what you really needed:

its(:currency, :us) { should == 'US dollar' }
its(:currency, :au) { should == 'AU dollar' }
its(:currency, :uk) { should == 'UK pound' }

Installation and use

Add to your Gemfile:

gem 'its'

Then require it somewhere:

require 'its'

And you are done.

Help

Please report any issues here or better submit a Pull Request.

License:

MIT by me and RSpec guys where this code was extracted from.

Something went wrong with that request. Please try again.