Sha256: 99223117bc90e2a032b9f90666adbd2323e8966b95194517b3c8c4c24aaa9268

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 Bytes

Contents

# Configuration point number one: setting and configuring states

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

2 entries across 2 versions & 1 rubygems

Version Path
maintain-0.1.1 spec/aggregates_spec.rb
maintain-0.1.0 spec/aggregates_spec.rb