Allow `its` keyword to take parameters
Created by: JoshCheek
In pretty much every project I find myself wanting to describe objects through methods that take parameters like this:
class Person
def initialize(first_name, last_name)
@first_name, @last_name = first_name, last_name
end
def name(format)
format.gsub('%f', @first_name).gsub('%l', @last_name)
end
end
describe Person do
subject { Person.new 'Josh', 'Cheek' }
its(:name, '%f') { should == 'Josh' }
its(:name, '%l') { should == 'Cheek' }
its(:name, '%f %l') { should == 'Josh Cheek' }
end
This commit adds this feature.