Sha256: d150a2eb7b047a1f7c90419a8703ebd1fe0bcf8b005a132d4f1d34ad2c71267b

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

require 'spec_helper'

describe "object_extensions" do
  describe "blank?" 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
royw-roys_extensions-0.0.4 spec/object_extensions_spec.rb