Sha256: 7e3cc0152104bde71eac0820ccfa3c47bd6e2afde632b7c23b2f239b7ebe89a2

Contents?: true

Size: 796 Bytes

Versions: 11

Compression:

Stored size: 796 Bytes

Contents

# Tests on integer-specific functionality

require 'lib/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

11 entries across 11 versions & 1 rubygems

Version Path
maintain-0.2.17 spec/integer_spec.rb
maintain-0.2.16 spec/integer_spec.rb
maintain-0.2.15 spec/integer_spec.rb
maintain-0.2.14 spec/integer_spec.rb
maintain-0.2.13 spec/integer_spec.rb
maintain-0.2.12 spec/integer_spec.rb
maintain-0.2.11 spec/integer_spec.rb
maintain-0.2.10 spec/integer_spec.rb
maintain-0.2.9 spec/integer_spec.rb
maintain-0.2.8 spec/integer_spec.rb
maintain-0.2.6 spec/integer_spec.rb