2
如何爲活動記錄範圍編寫測試?例如如何編寫活動記錄範圍的測試?
class Post < ActiveRecord::Base
scope :recent, -> { order("posts.created_at DESC") }
scope :published, -> { where("status = 1") }
end
我使用RSpec測試,
RSpec.feature Post, :type => :model do
let(:post) { build(:post) }
describe 'test scopes' do
end
end