Last active
December 16, 2015 11:48
-
-
Save Arkham/5429515 to your computer and use it in GitHub Desktop.
customer spec
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
require "spec_helper" | |
describe Customer do | |
subject(:customer) { Customer.new('Mario', 'Rossi') } | |
its(:full_name) { should == "Mario Rossi" } | |
context "for a single movie" do | |
let(:rental) { double } | |
before { customer.rent(rental) } | |
its(:rentals) { should == [rental] } | |
end | |
context "for all rentals" do | |
let(:first_rental) { double(:charge => 1, :points => 2) } | |
let(:second_rental) { double(:charge => 2, :points => 3) } | |
before(:each) do | |
customer.rent(first_rental) | |
customer.rent(second_rental) | |
end | |
its(:total_charge) { should == 3 } | |
its(:total_points) { should == 5 } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment