为复杂查询方法生成rspec

时间:2016-10-29 08:59:28

标签: ruby-on-rails rspec factory-bot

问题

我的通知模型中有一个方法,它返回复杂查询的结果

BookMember
  .joins(" INNER JOIN notifications on notifications.reference = book_members.id")
  .joins(:book)
  .select("notifications.*,book_members.id as bookmemid, book_members.invited_by as invited_by, books.book_name as bookname, books.id as bookid")
  .where("notifications.id in (?)",bookset)

我想用

测试它
expect(real_result).to eq expected_result

如何生成expected_result

0 个答案:

没有答案