Sha256: 4d7db9ffbacaf161c49a34b18775159c70f0f1e3003dba89f3db5b0360735fd3

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe FalseClass do
  describe "#to_yes_no" do
    it 'converts correctly with no options' do
      false.to_yes_no.should == "No"
    end
    it 'converts correctly when if_no is set' do
      false.to_yes_no(:if_no => "no way").should == "no way"
    end
    it 'converts correctly to uppercase' do
      false.to_yes_no(:format => "Up").should == "NO"
    end
    it 'converts correctly to uppercase when if_no is set' do
      false.to_yes_no(:format => "Up", :if_no => "no way").should == "NO WAY"
    end
    it 'converts correctly to downcase' do
      false.to_yes_no(:format => "Down").should == "no"
    end
    it 'converts correctly to downcase when if_no is set' do
      false.to_yes_no(:format => "Down", :if_no => "NO WAY").should == "no way"
    end
    it 'converts correctly when format is an unsupported string' do
      false.to_yes_no(:format => "Hokie's Rules").should == "No"
    end
    it 'converts correctly when format is an unsupported string and if_no is set' do
      false.to_yes_no(:format => "Hokie's Rules", :if_no => "chuck norris").should == "Chuck norris"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
corelib-0.0.6 spec/boolean/false_spec.rb
corelib-0.0.5 spec/boolean/false_spec.rb
corelib-0.0.4 spec/boolean/false_spec.rb
corelib-0.0.3 spec/boolean/false_spec.rb
corelib-0.0.2 spec/boolean/false_spec.rb