Sha256: 6b2e40a571378a47aff5b25f677ddba0080eb6040c5d567eb164edda72b1520d

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

RSpec.describe WannabeBool::Symbol do
  describe '#to_b' do
    [ :'1', :'1 ', :' 1 ', :' 1',
      :t, :'t ', :' t', :' t ',
      :T, :'T ', :' T', :' T ',
      :true, :'true ', :' true', :' true ',
      :TRUE, :'TRUE ', :' TRUE', :' TRUE ',
      :on, :'on ', :' on', :' on ',
      :ON, :'ON ', :' ON ', :' ON ',
      :y, :'y ', :' y', :' y ',
      :Y, :'Y ', :' Y', :' Y ',
      :yes, :'yes ', :' yes', :' yes ',
      :YES, :'YES ', :' YES', :' YES '
    ].each do |value|
      context "when symbol is '#{value}'" do
        subject { value }
        it { expect(subject.to_b).to be true }
      end
    end

    [ :'',
      :'0', :'2', :'-1', :'-2',
      :f, :F,
      :false, :FALSE,
      :off, :OFF,
      :n, :N,
      :no, :NO,
      :not, :NOT,
      :wherever, :Prodis
    ].each do |value|
      context "when symbol is '#{value}'" do
        subject { value }
        it { expect(subject.to_b).to be false }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wannabe_bool-0.6.0 spec/wannabe_bool/symbol_spec.rb