Project

its

0.01
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
You can write `its(:currency, :us) { should == 'US dollars' }`
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

"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.