모델의 scope와 같이 모델 인스턴스를 검색하는 부분은 단위테스트가 작성이 안 되어있는 것 같습니다.
작성이 필요할 것 같네요. ㅎㅎ 가령
class User < ActiveRecord::Base
scope :generation_sorted_desc, -> { order(generation_id: :desc) }
scope :responsed_to_notice, -> (notice) { joins(:responses).merge(Response.where(notice: notice)) }
Response::STATUSES.each do |status|
scope "responsed_#{status}", -> (notice) { responsed_to_notice(notice).merge(Response.where(status: status)) }
end
scope :responsed_not_to_notice, -> (notice) {
SQL = %{LEFT OUTER JOIN (SELECT * FROM responses WHERE responses.notice_id = #{notice.id} ) A
ON users.id = A.user_id
WHERE A.status is null}
joins(SQL) }
scope :order_by_gid, -> {order(generation_id: :desc)}
scope :order_by_responsed_at, -> {order('responses.created_at DESC')}
scope :order_by_read_at, -> {order('read_activity_marks.created_at DESC')}
end
요 scope 부분도 전부 작성해야 할 것 같습니다.
scope의 단위테스트 작성에 관한 건 이 코멘트를 참조해 주세요. ㅎㅎ
모델의
scope와 같이 모델 인스턴스를 검색하는 부분은 단위테스트가 작성이 안 되어있는 것 같습니다.작성이 필요할 것 같네요. ㅎㅎ 가령
요
scope부분도 전부 작성해야 할 것 같습니다.scope의 단위테스트 작성에 관한 건 이 코멘트를 참조해 주세요. ㅎㅎ