Sha256: bc379bdd3c7874deb85d424ac335ea42a3721888292ef1bd8f0f3cf07afb9da8
Contents?: true
Size: 1.87 KB
Versions: 9
Compression:
Stored size: 1.87 KB
Contents
require File.dirname(__FILE__)+'/../spec_helper' require 'gorillib/object/blank' describe 'object/blank' do describe Object do it 'should provide blank?' do Object.new.should respond_to(:blank?) end it 'should be blank if it is nil' do object = Object.new class << object def nil?; true end end object.should be_blank end it 'should be blank if it is empty' do {}.should be_blank [].should be_blank end it 'should not be blank if not nil or empty' do Object.new.should_not be_blank [nil].should_not be_blank { nil => 0 }.should_not be_blank end it 'should be present if not blank' do nil.should_not be_present "blarg".should be_present end end describe Numeric do it 'should provide blank?' do 1.should respond_to(:blank?) end it 'should never be blank' do 1.should_not be_blank end end describe NilClass do it 'should provide blank?' do nil.should respond_to(:blank?) end it 'should always be blank' do nil.should be_blank end end describe TrueClass do it 'should provide blank?' do true.should respond_to(:blank?) end it 'should never be blank' do true.should_not be_blank end end describe FalseClass do it 'should provide blank?' do false.should respond_to(:blank?) end it 'should always be blank' do false.should be_blank end end describe String do it 'should provide blank?' do 'string'.should respond_to(:blank?) end it 'should be blank if empty' do ''.should be_blank end it 'should be blank if it only contains whitespace' do ' '.should be_blank " \r \n \t ".should be_blank end it 'should not be blank if it contains non-whitespace' do ' a '.should_not be_blank end end end
Version data entries
9 entries across 9 versions & 1 rubygems