Repository URL to install this package:
| 
      
        
        
        Version: 
        
         
          
          2.23.0  ▾
        
         | 
require 'spec_helper'
describe String do
  describe "to_bool" do
    describe "booleanable values" do
      it "returns true for each truthy String" do
        true_strings = ["t", "true", "1", "y", "yes"]
        expect(true_strings.map(&:to_bool)).to eq([true] * true_strings.size)
      end
      it "returns true for each falsy String" do
        false_strings = ["f", "false", "0", "n", "no"]
        expect(false_strings.map(&:to_bool)).to eq([false] * false_strings.size)
      end
    end
    describe "invalid Strings" do
      it "raises an exception for Strings which cannot be determined" do
        expect { "whatever, man.".to_bool }.to raise_exception()
      end
    end
  end
end