Sha256: 5037cd9f914d53fb9dce4e4d782c2f63944ba7b588a4c1a62d820128370f518c

Contents?: true

Size: 913 Bytes

Versions: 2

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'

describe "ObjectExtensions" do
  it "should be blank for nil" do
    nil.blank?.should be_true
  end

  it "should be blank for empty String" do
    ''.blank?.should be_true
  end

  it "should be blank for pure white space String" do
    ' '.blank?.should be_true
  end

  it "should be blank for empty Array" do
    [].blank?.should be_true
  end

  it "should be blank for Array of nils" do
    [nil, nil].blank?.should be_true
  end

  it "should be blank for empty Hash" do
    {}.blank?.should be_true
  end

  it "should not be blank for non-empty String" do
    ' foo '.blank?.should be_false
  end

  it "should not be blank for non-empty Array" do
    [1].blank?.should be_false
  end

  it "should not be blank for empty embedded Arrays" do
    [[]].blank?.should be_false
  end

  it "should not be blank for non-empty Hash" do
    {:a => nil}.blank?.should be_false
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
royw-roys_extensions-0.0.2 spec/object_extensions_spec.rb
royw-roys_extensions-0.0.3 spec/object_extensions_spec.rb