Sha256: f15b2445e982a4d2475a229dcba919ff39ea024f05dc262655c61b2ae97d56cc

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
wannabe_bool-0.5.0 spec/wannabe_bool/symbol_spec.rb
wannabe_bool-0.4.0 spec/wannabe_bool/symbol_spec.rb