Sha256: 8f0e51149962d5e14c15c7545780a0c50b8e1df6f0047a6346ad2b32a6075599

Contents?: true

Size: 814 Bytes

Versions: 6

Compression:

Stored size: 814 Bytes

Contents

# Tests on integer-specific functionality

require 'spec_helper'
require 'maintain'

describe Maintain do
  before :each do
    class ::MaintainTest
      extend Maintain
    end
  end

  describe "integer" do
    before :each do
      MaintainTest.maintain :kind, :integer => true do
        state :man, 1
        state :woman, 2, :default => true
        state :none, 3
      end
      @maintainer = MaintainTest.new
    end

    it "should handle numbery strings" do
      @maintainer.kind = "3"
      @maintainer.none?.should be_true
    end

    it "should handle defaults just fine" do
      @maintainer.woman?.should be_true
    end

    it "should return valid names, too" do
      @maintainer.kind = :woman
      @maintainer.kind.should == 2
      @maintainer.kind.name.should == "woman"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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