Skip to content

Instantly share code, notes, and snippets.

@Arkham
Last active December 16, 2015 11:48
Show Gist options
  • Save Arkham/5429515 to your computer and use it in GitHub Desktop.
Save Arkham/5429515 to your computer and use it in GitHub Desktop.
customer spec
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