Sha256: ad79f22963b6b64bb83e4453a4b982d8ab3b896f9181b19b6870c6ee0a978382
Contents?: true
Size: 621 Bytes
Versions: 13
Compression:
Stored size: 621 Bytes
Contents
require 'spec_helper' describe Virtus::Coercion::String, '.to_boolean' do subject { object.to_boolean(string) } let(:object) { described_class } %w[ 1 on ON t true T TRUE y yes Y YES ].each do |value| context "with #{value.inspect}" do let(:string) { value } it { should be(true) } end end %w[ 0 off OFF f false F FALSE n no N NO ].each do |value| context "with #{value.inspect}" do let(:string) { value } it { should be(false) } end end context 'with an invalid boolean string' do let(:string) { 'non-boolean' } it { should equal(string) } end end
Version data entries
13 entries across 13 versions & 2 rubygems