Sha256: cf2e4a0176888394483add09df22e45f3a1d7c24d20f0de2585910bccf26bbbe

Contents?: true

Size: 1.63 KB

Versions: 7

Compression:

Stored size: 1.63 KB

Contents

#
#  Copyright (C) 2014-2018  Enrico Rivarola
#
#  This file is part of DcmDict gem (dcm_dict).
#
#  DcmDict is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  DcmDict is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with DcmDict.  If not, see <http://www.gnu.org/licenses/>.
#
#  This software has neither been tested nor approved for clinical use
#  or for incorporation in a medical device.
#  It is the redistributor's or user's responsibility to comply with any
#  applicable local, state, national or international regulations.
#
require 'spec_helper'

describe "Object extension" do

  describe "should check object for nil or empty status" do
    describe "for class with empty? method" do
      it "as string object" do
        expect("bla bla".nil_or_empty?).to be_falsy
        expect("".nil_or_empty?).to be_truthy
      end

      it "as array object" do
        expect([1, 2].nil_or_empty?).to be_falsy
        expect([].nil_or_empty?).to be_truthy
      end

    end

    describe "for class without empty? method" do
      it "as fixnum object" do
        expect(5.nil_or_empty?).to be_falsy
      end

      it "as nil object" do
        expect(nil.nil_or_empty?).to be_truthy
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dcm_dict-0.21.1 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.20.2 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.20.1 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.20.0 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.19.0 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.18.0 spec/dcm_dict/ext/object_extension_spec.rb
dcm_dict-0.17.0 spec/dcm_dict/ext/object_extension_spec.rb