diff --git a/lib/gorillib/hashlike.rb b/lib/gorillib/hashlike.rb
index a489c6d..608afed 100644
--- a/lib/gorillib/hashlike.rb
+++ b/lib/gorillib/hashlike.rb
@@ -821,4 +821,3 @@ def self.included(base)
end
end
-
diff --git a/lib/gorillib/receiver/acts_as_hash.rb b/lib/gorillib/receiver/acts_as_hash.rb
index 5c87487..1e5c4a6 100644
--- a/lib/gorillib/receiver/acts_as_hash.rb
+++ b/lib/gorillib/receiver/acts_as_hash.rb
@@ -119,30 +119,6 @@ def delete(key, &block)
end
end
- # # Hashlike#==
- # #
- # # Equality -- Two hashes are equal if they contain the same number of keys,
- # # and the value corresponding to each key in the first hash is equal (using
- # # ==) to the value for the same key in the second. If +obj+ is not a
- # # Hashlike, attempt to convert it using +to_hash+ and return obj ==
- # # hsh.
- # #
- # # Does not take a default value comparion into account.
- # #
- # # @example
- # # h1 = { :a => 1, :c => 2 }
- # # h2 = { 7 => 35, :c => 2, :a => 1 }
- # # h3 = { :a => 1, :c => 2, 7 => 35 }
- # # h4 = { :a => 1, :d => 2, :f => 35 }
- # # h1 == h2 # => false
- # # h2 == h3 # => true
- # # h3 == h4 # => false
- # #
- # def ==(other_hash)
- # (length == other_hash.length) &&
- # all?{|k,v| v == other_hash[k] }
- # end
-
# Hashlike#keys
#
# Returns a new array populated with the keys from this hashlike.
@@ -186,6 +162,7 @@ def convert_key(key)
def self.included base
base.extend ClassMethods
+ base.send(:include, Gorillib::Hashlike)
end
end
end
diff --git a/spec/struct/acts_as_hash_fuzz_spec.rb b/spec/struct/acts_as_hash_fuzz_spec.rb
index af92933..8cf94c9 100644
--- a/spec/struct/acts_as_hash_fuzz_spec.rb
+++ b/spec/struct/acts_as_hash_fuzz_spec.rb
@@ -16,51 +16,55 @@
Enumerable.public_instance_methods.map(&:to_sym) +
HashlikeHelper::HASH_METHODS_MISSING_FROM_VERSION
-include HashlikeFuzzingHelper
+describe Gorillib::Struct::ActsAsHash do
+ if ENV['FULL_SPECS']
+ include HashlikeFuzzingHelper
-describe "Hash vs Gorillib::Struct::ActsAsHash" do
- before do
- @total = 0
- @hsh = HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT.dup
- @hshlike = StructUsingHashlike.new.merge(HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
- end
+ describe "vs Hash" do
+ before do
+ @total = 0
+ @hsh = HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT.dup
+ @hshlike = StructUsingHashlike.new.merge(HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
+ end
- ( HashlikeHelper::METHODS_TO_TEST - STRUCT_HASHLIKE_METHODS_TO_SKIP ).each do |method_to_test|
- describe "##{method_to_test}" do
+ ( HashlikeHelper::METHODS_TO_TEST - STRUCT_HASHLIKE_METHODS_TO_SKIP ).each do |method_to_test|
+ describe "##{method_to_test}" do
- (HashlikeFuzzingHelper::INPUTS_FOR_ALL_HASHLIKES).each do |input|
- next if HashlikeFuzzingHelper::SPECIAL_CASES_FOR_HASHLIKE_STRUCT[method_to_test].include?(input)
+ (HashlikeFuzzingHelper::INPUTS_FOR_ALL_HASHLIKES).each do |input|
+ next if HashlikeFuzzingHelper::SPECIAL_CASES_FOR_HASHLIKE_STRUCT[method_to_test].include?(input)
- it "on #{input.inspect}" do
- behaves_the_same(@hsh, @hshlike, method_to_test, input)
+ it "on #{input.inspect}" do
+ behaves_the_same(@hsh, @hshlike, method_to_test, input)
+ end
+ end
end
end
end
- end
-end
-describe "Gorillib::HashWithIndifferentSymbolKeys vs Gorillib::Struct::ActsAsHash" do
- before do
- @total = 0
- @hsh = Gorillib::HashWithIndifferentSymbolKeys.new_from_hash_copying_default(
- HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
- @hshlike = StructUsingHashlike.new.merge(
- HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
- end
+ describe "vs Gorillib::HashWithIndifferentSymbolKeys" do
+ before do
+ @total = 0
+ @hsh = Gorillib::HashWithIndifferentSymbolKeys.new_from_hash_copying_default(
+ HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
+ @hshlike = StructUsingHashlike.new.merge(
+ HashlikeHelper::HASH_TO_TEST_HASHLIKE_STRUCT)
+ end
- ( HashlikeHelper::METHODS_TO_TEST - STRUCT_HASHLIKE_METHODS_TO_SKIP
- ).each do |method_to_test|
- describe "##{method_to_test}" do
+ ( HashlikeHelper::METHODS_TO_TEST - STRUCT_HASHLIKE_METHODS_TO_SKIP
+ ).each do |method_to_test|
+ describe "##{method_to_test}" do
- ( HashlikeFuzzingHelper::INPUTS_WHEN_INDIFFERENT_ACCESS +
- HashlikeFuzzingHelper::INPUTS_FOR_ALL_HASHLIKES
- ).each do |input|
- next if HashlikeFuzzingHelper::SPECIAL_CASES_FOR_HASHLIKE_STRUCT[method_to_test].include?(input)
+ ( HashlikeFuzzingHelper::INPUTS_WHEN_INDIFFERENT_ACCESS +
+ HashlikeFuzzingHelper::INPUTS_FOR_ALL_HASHLIKES
+ ).each do |input|
+ next if HashlikeFuzzingHelper::SPECIAL_CASES_FOR_HASHLIKE_STRUCT[method_to_test].include?(input)
- it "on #{input.inspect}" do
- behaves_the_same(@hsh, @hshlike, method_to_test, input)
- end
+ it "on #{input.inspect}" do
+ behaves_the_same(@hsh, @hshlike, method_to_test, input)
+ end
+ end
+ end
end
end
end