如何使用 should_receive 规范 ActiveRecord::Base.find(something).method ?
假设我们有以下代码:
class Post < ActiveRecord::Base
def self.fix_published_times
where(:published => true, :published_at => nil).limit(5).each do |post
post.fix_published_at!
end
end
end
我应该如何规范 Post#fix_published__at!
with should_receive?
Let's say we have the following code:
class Post < ActiveRecord::Base
def self.fix_published_times
where(:published => true, :published_at => nil).limit(5).each do |post
post.fix_published_at!
end
end
end
How should I spec Post#fix_published__at!
with should_receive?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类似的事情应该有效:
Something along this lines of this should work: