Skip to content

Instantly share code, notes, and snippets.

View aldesantis's full-sized avatar

Alessandro Desantis aldesantis

View GitHub Profile
require 'rails_helper'
RSpec.describe Processable do
before(:all) do
Temping.create :processable_model do
include Processable
with_columns do |t|
t.boolean :processable, default: false
end
class Task < ActiveRecord::Base
include Processable
end
require 'active_support/concern'
module Processable
extend ActiveSupport::Concern
included do
scope :processed, ->{ where processed: true }
scope :unprocessed, ->{ where processed: false }
end