From 0717f95455d882875107086544477fe9e8253fa1 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:32:42 -0400 Subject: Ruby 1.8.7 doesn't preserve hash insertion order --- spec/support/augeas.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/support/augeas.rb b/spec/support/augeas.rb index 4912e1a..7548684 100644 --- a/spec/support/augeas.rb +++ b/spec/support/augeas.rb @@ -19,9 +19,10 @@ module Augeas [target, name, Change].hash end - def eql?(other) + def ==(other) other.is_a?(self.class) && [other.target, other.name] == [target, name] end + alias_method :eql?, :== private @@ -37,11 +38,12 @@ module Augeas class ChangeSet def initialize - @set = {} + @set = [] end def <<(change) - @set[change] = change + index = @set.index(change) || @set.length + @set[index] = change end def to_a @@ -49,7 +51,7 @@ module Augeas end def changes - @set.values.map(&:to_s) + @set.map(&:to_s) end end -- cgit v1.2.3