Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
j_platform / spec / classes / string_spec.rb
Size: Mime:
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