This repository has been archived by the owner on May 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
`Its` makes testing methods with multiple arguments much easier | ||
================================================== | ||
|
||
Have you ever written something like this in your specs? | ||
|
||
```ruby | ||
it "should be US currency" do | ||
subject.currency(:us).should == 'US dollar' | ||
end | ||
|
||
it "should be AU currency" do | ||
subject.currency(:us).should == 'AU dollar' | ||
end | ||
|
||
it "should be UK currency" do | ||
subject.currency(:uk).should == 'UK pound' | ||
end | ||
``` | ||
|
||
If yes, then this what you really wanted: | ||
|
||
```ruby | ||
its(:currency, :us) { should == 'US dollar' } | ||
its(:currency, :au) { should == 'AU dollar' } | ||
its(:currency, :uk) { should == 'UK pound' } | ||
``` | ||
|
||
This gems gives you this. | ||
|
||
Installation and use | ||
================================================== | ||
|
||
Add to your `Gemfile`: | ||
|
||
```ruby | ||
gem 'its' | ||
``` | ||
|
||
Then require it somewhere: | ||
|
||
```ruby | ||
require 'its' | ||
``` | ||
|
||
And you are done. | ||
|
||
|
||
Help | ||
================================================== | ||
|
||
Please report any issues here or better submit a Pull Request. | ||
|
||
|
||
|
||
License: | ||
================================================== | ||
|
||
MIT |