测试 请教 RSpec 中的 put 是什么动作?

woody1983 · 2012年09月01日 · 最后由 woody1983 回复于 2012年09月01日 · 2222 次阅读
describe "submitting a PUT request to the Users#update action" do
        before { put user_path(wrong_user) }
        specify { response.should redirect_to(root_path) }
end

http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#sec-requiring_the_right_user

这一步的测试我一直没有搞明白他要测试的是什么?第一个是不能编辑其他 user 的信息,这第二个看起来头晕。

这代码不是已经很清楚了么?提交 PUT 到错误的用户。

#1 楼 @fredwu 是 rest 里的 put 动作吗?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号