Created
December 3, 2011 04:21
-
-
Save mattm/1426014 to your computer and use it in GitHub Desktop.
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
## Factory | |
Factory.define :promo, :class => Promotion do |promo| | |
promo.code "cm" | |
promo.quantity 100 | |
promo.remaining 100 | |
promo.description "for chris and mike" | |
end | |
## Spec | |
it "should decrement the promotion code's remaining value by one" do | |
promo = Factory.create(:promo) | |
get 'search', :q => 'flower -p cm' | |
Promotion.find(promo.id).remaining.should == promo.remaining - 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how I would test it: