Created
December 8, 2009 20:19
-
-
Save ethangunderson/251961 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
def finalized? | |
clicked_finalized? && (total_final_invoice.blank? || charged_on) | |
end |
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
describe Cart, 'when checking if a cart is finalized' do | |
before(:each) do | |
@cart = Cart.new | |
@cart.stub!(:clicked_finalized?).and_return(true) | |
@cart.stub!(:total_final_invoice).and_return("10.50") | |
end | |
it 'will not be finalized if the customer has not clicked finalized' do | |
@cart.stub!(:clicked_finalized?).and_return(false) | |
@cart.should_not be_finalized | |
end | |
it 'will not be finalized if the final price is more than zero and the customer has not been charged' do | |
@cart.should_not be_finalized | |
end | |
it 'will be finalized if finalized is clicked and price is zero' do | |
@cart.stub!(:total_final_invoice).and_return("") | |
@cart.should be_finalized | |
end | |
it 'will be finalized if finalized is clicked and the customer is charged' do | |
@cart.stub!(:charged_on).and_return(Time.now) | |
@cart.should be_finalized | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment