Sha256: b88865f476c37aedb69814b8fc333c4d1c13104ce4335331cd238075da6e633b

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

# Specs for aggregation of state

require 'spec_helper'
require '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

7 entries across 7 versions & 1 rubygems

Version Path
maintain-0.3.0 spec/aggregates_spec.rb
maintain-0.2.23 spec/aggregates_spec.rb
maintain-0.2.22 spec/aggregates_spec.rb
maintain-0.2.21 spec/aggregates_spec.rb
maintain-0.2.20 spec/aggregates_spec.rb
maintain-0.2.19 spec/aggregates_spec.rb
maintain-0.2.18 spec/aggregates_spec.rb