Sha256: b4fee10bda627f5635c41e9a8536d74b3114222ed79efaf60b1c2c78b632d837

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'
require 'parameters/types/boolean'

describe Parameters::Types::Boolean do
  subject { described_class }

  describe "#===" do
    it "should match true" do
      subject.should === true
    end

    it "should match false" do
      subject.should === false
    end

    it "should not match anything else" do
      subject.should_not === 1
    end
  end

  describe "#coerce" do
    it "should map false to false" do
      subject.coerce(false).should == false
    end

    it "should map 'false' to false" do
      subject.coerce('false').should == false
    end

    it "should map :false to false" do
      subject.coerce(:false).should == false
    end

    it "should map nil to false" do
      subject.coerce(nil).should == false
    end

    it "should map everything else to true" do
      subject.coerce(:foo).should == true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parameters-0.3.0 spec/types/boolean_spec.rb