Sha256: a93edf2c44cd7305dcd24f675bf315a9d24a5606f3259c4b15014e25d8886b70
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
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 for inverse elements" do unknowns = CashRegister.create!(status: CashRegister::UNKNOWN) actives = CashRegister.create!(status: CashRegister::ACTIVE) alarms = CashRegister.create!(status: CashRegister::ALARM) expect(CashRegister.known).to contain_exactly(actives, alarms) 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 inverse scopes with prefixed names for each namespaced element" do opened = CashRegister.new.tap(&:open!) closed = CashRegister.new.tap(&:close!) expect(CashRegister.drawer_position_not_open).to contain_exactly(closed) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flexible_enum-0.4.2 | spec/scopes_spec.rb |
flexible_enum-0.4.1 | spec/scopes_spec.rb |