How can I write tests for active record scopes? for example
class Post < ActiveRecord::Base
scope :recent, -> { order("posts.created_at DESC") }
scope :published, -> { where("status = 1") }
end
I'm using Rspec for testing
RSpec.feature Post, :type => :model do
let(:post) { build(:post) }
describe 'test scopes' do
end
end
Aucun commentaire:
Enregistrer un commentaire