Sha256: 2f88e6a68ed4ceb984e3799c244b16b8ee16aa5aa65c3926b883c5f8eb538b7a

Contents?: true

Size: 794 Bytes

Versions: 8

Compression:

Stored size: 794 Bytes

Contents

require 'test_helper'

class VedeuCommonClass
  include Vedeu::Common

  def defined_value_test(variable)
    defined_value?(variable)
  end
end # VedeuCommonClass

module Vedeu

  describe Common do

    describe '#defined_value?' do
      it 'return true when the variable is not nil or empty' do
        VedeuCommonClass.new.defined_value_test('not empty').must_equal(true)
      end

      it 'returns false when the variable is nil or empty' do
        VedeuCommonClass.new.defined_value_test([]).must_equal(false)
      end

      it 'returns false when dealing with hash keys which may not exist or ' \
         'have a value' do
        attributes = {}

        VedeuCommonClass.new.defined_value_test(attributes[:misc]).must_equal(false)
      end
    end

  end # Common

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.2.12 test/lib/vedeu/support/common_test.rb
vedeu-0.2.11 test/lib/vedeu/support/common_test.rb
vedeu-0.2.10 test/lib/vedeu/support/common_test.rb
vedeu-0.2.9 test/lib/vedeu/support/common_test.rb
vedeu-0.2.8 test/lib/vedeu/support/common_test.rb
vedeu-0.2.7 test/lib/vedeu/support/common_test.rb
vedeu-0.2.6 test/lib/vedeu/support/common_test.rb
vedeu-0.2.5 test/lib/vedeu/support/common_test.rb