Skip to content

Instantly share code, notes, and snippets.

@phuibonhoa
Created March 30, 2011 01:47
Show Gist options
  • Save phuibonhoa/893715 to your computer and use it in GitHub Desktop.
Save phuibonhoa/893715 to your computer and use it in GitHub Desktop.
ex: execute in shoulda tests
context ".rent book with quantity" do
setup do
@book = Factory(:book, :quantity => 1)
@customer = Factory(:customer)
end
execute do
@customer.rent(@book)
end
should "create order for customer" do
assert_equal 1, @customer.orders.size
end
should "decrement quantity for book" do
assert_equal 0, @book.quantity
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment