Agile Web Development with Rails, Third Edition - question1

Agile Web Development with Rails, Third Edition - question1

================================================

2010,02,26

 

Page 244
(depot/test/integration/user_stories_test.rb,38行)
"
assert_equal 0, session[:cart].items.size
"
为什么这个测试能成功呢?保存 order 的 action 是这样处理的:
(depot/app/controllers/store_controller.rb,36-38行)
"
if @order.save
  session[:cart] = nil
  redirect_to_index(I18n.t('flash.thanks'))
"
按照道理保存 order 之后 session[:cart] 就是 nil 了,怎么可能还会有 session[:cart].items.size = 0 呢?

 

==

同时发布在:

http://www.zeuux.com/blog/content/2431/

 

你可能感兴趣的:(Web,Blog,Flash,Rails)