Sha256: ce2e709ca6569728c142d335643b36be738da8142e24cce80f2b1ba805f2f662

Contents?: true

Size: 787 Bytes

Versions: 18

Compression:

Stored size: 787 Bytes

Contents

# Specs for aggregation of state

require 'lib/maintain'

describe Maintain, "aggregates" do
  before :each do
    class ::MaintainTest
      extend Maintain
    end
  end

  it "should allow me to define an aggregate" do
    lambda {
      MaintainTest.maintains :state do
        state :old
        state :new
        state :borrowed
        state :blue
        aggregate :b_words, [:borrowed, :blue]
      end
    }.should_not raise_error
  end

  it "should create boolean methods" do
    MaintainTest.new.should respond_to(:b_words?)
  end

  it "should return true if one of the states is met in the boolean" do
    maintain = MaintainTest.new
    maintain.state = :new
    maintain.b_words?.should be_false
    maintain.state = :blue
    maintain.b_words?.should be_true
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
maintain-0.2.17 spec/aggregates_spec.rb
maintain-0.2.16 spec/aggregates_spec.rb
maintain-0.2.15 spec/aggregates_spec.rb
maintain-0.2.14 spec/aggregates_spec.rb
maintain-0.2.13 spec/aggregates_spec.rb
maintain-0.2.12 spec/aggregates_spec.rb
maintain-0.2.11 spec/aggregates_spec.rb
maintain-0.2.10 spec/aggregates_spec.rb
maintain-0.2.9 spec/aggregates_spec.rb
maintain-0.2.8 spec/aggregates_spec.rb
maintain-0.2.6 spec/aggregates_spec.rb
maintain-0.2.5 spec/aggregates_spec.rb
maintain-0.2.4 spec/aggregates_spec.rb
maintain-0.2.2 spec/aggregates_spec.rb
maintain-0.2.1 spec/aggregates_spec.rb
maintain-0.1.9 spec/aggregates_spec.rb
maintain-0.1.8 spec/aggregates_spec.rb
maintain-0.1.7 spec/aggregates_spec.rb