开发者

whats wrong with this test?

test "login logout user is not online" do
get :login, :id=>1
before = User.find(1).is_online
get :logout, :id=>1
after = User.find(1).is_online
puts before
puts after
assert before == 1
assert after == 0

end

the output is
1
0

<false> is not true.
test/fu开发者_JAVA技巧nctional/users_controller_test.rb:22:in `test_login_logout_user_is_not_online'


the only problem I could mind here is that before and after are strings:

irb(main):023:0> '1' == 1
=> false
irb(main):025:0> '1'.to_i == 1
=> true
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜