Sha256: 51b81ceacf9533e53b0fc69c025483c17813e098af8295aca3d3e2a07797e780

Contents?: true

Size: 991 Bytes

Versions: 13

Compression:

Stored size: 991 Bytes

Contents

require 'helper'

describe "Boolean.to_store" do
  it "should be true for true" do
    Boolean.to_store(true).should be_true
  end

  it "should be false for false" do
    Boolean.to_store(false).should be_false
  end

  it "should handle odd assortment of other values" do
    Boolean.to_store('true').should be_true
    Boolean.to_store('t').should be_true
    Boolean.to_store('1').should be_true
    Boolean.to_store(1).should be_true

    Boolean.to_store('false').should be_false
    Boolean.to_store('f').should be_false
    Boolean.to_store('0').should be_false
    Boolean.to_store(0).should be_false
  end

  it "should be nil for nil" do
    Boolean.to_store(nil).should be_nil
  end
end

describe "Boolean.from_store" do
  it "should be true for true" do
    Boolean.from_store(true).should be_true
  end

  it "should be false for false" do
    Boolean.from_store(false).should be_false
  end

  it "should be nil for nil" do
    Boolean.from_store(nil).should be_nil
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
toystore-0.8.3 spec/toy/extensions/boolean_spec.rb
toystore-0.8.2 spec/toy/extensions/boolean_spec.rb
toystore-0.8.1 spec/toy/extensions/boolean_spec.rb
toystore-0.8.0 spec/toy/extensions/boolean_spec.rb
toystore-0.7.0 spec/toy/extensions/boolean_spec.rb
toystore-0.6.6 spec/toy/extensions/boolean_spec.rb
toystore-0.6.5 spec/toy/extensions/boolean_spec.rb
toystore-0.6.4 spec/toy/extensions/boolean_spec.rb
toystore-0.6.3 spec/toy/extensions/boolean_spec.rb
toystore-0.6.2 spec/toy/extensions/boolean_spec.rb
toystore-0.6.1 spec/toy/extensions/boolean_spec.rb
toystore-0.6 spec/toy/extensions/boolean_spec.rb
toystore-0.5 spec/toy/extensions/boolean_spec.rb