Sha256: 6660ad267e1d3b7d7d2d3e86504a2efd7afb5c0da0ec2831943800a8522aab00

Contents?: true

Size: 785 Bytes

Versions: 5

Compression:

Stored size: 785 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

5 entries across 5 versions & 1 rubygems

Version Path
maintain-0.1.6 spec/aggregates_spec.rb
maintain-0.1.5 spec/aggregates_spec.rb
maintain-0.1.4 spec/aggregates_spec.rb
maintain-0.1.3 spec/aggregates_spec.rb
maintain-0.1.2 spec/aggregates_spec.rb