Sha256: 9df7fbb30f4d781c5052d69ba762b9eb5813628d4aef9013ad60d9f3901b2c10

Contents?: true

Size: 641 Bytes

Versions: 4

Compression:

Stored size: 641 Bytes

Contents

# -*- coding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper')

require 'active_support'
require "tengine/support/core_ext/hash/compact"

describe Hash do
  describe "#compact!" do
    it "Array#compat!と同じ" do
      h = { :foo => :bar, :baz => nil }
      h.compact!
      h.should include(:foo)
      h.should_not include(:baz)
    end
  end

  describe "#compact" do
    it "非破壊的" do
      h = { :foo => :bar, :baz => nil }
      hh = h.compact
      h.should include(:foo)
      h.should include(:baz)
      hh.should include(:foo)
      hh.should_not include(:baz)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tengine_support-0.3.27 spec/tengine/support/core_ext/hash/compact_spec.rb
tengine_support-0.3.26 spec/tengine/support/core_ext/hash/compact_spec.rb
tengine_support-0.3.25 spec/tengine/support/core_ext/hash/compact_spec.rb
tengine_support-0.3.24 spec/tengine/support/core_ext/hash/compact_spec.rb