Sha256: f9000531b674c3e8da0b5a2ff195bb6e3a7d5d4dbf183e88c3fe23cf33045e9f
Contents?: true
Size: 931 Bytes
Versions: 2
Compression:
Stored size: 931 Bytes
Contents
require 'spec_helper' describe "scopes" do it "builds scopes for each element" do actives = CashRegister.create!(status: CashRegister::ACTIVE) alarms = CashRegister.create!(status: CashRegister::ALARM) expect(CashRegister.active).to contain_exactly(actives) expect(CashRegister.alarm).to contain_exactly(alarms) expect(CashRegister.unknown).to be_empty end it "builds scopes with prefixed names for each namespaced element" do opened = CashRegister.new.tap(&:open!) closed = CashRegister.new.tap(&:close!) expect(CashRegister.drawer_position_opened).to contain_exactly(opened) expect(CashRegister.drawer_position_closed).to contain_exactly(closed) end it "builds scopes that aren't affected by default scopes" do WithDefaultScope.new.tap(&:active!) passive = WithDefaultScope.new.tap(&:passive!) expect(WithDefaultScope.passive).to contain_exactly(passive) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flexible_enum-0.3.0 | spec/scopes_spec.rb |
flexible_enum-0.2.2 | spec/scopes_spec.rb |