aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jahn <ajjahn@gmail.com>2016-07-08 15:32:42 -0400
committerAdam Jahn <ajjahn@gmail.com>2016-07-08 15:32:42 -0400
commit0717f95455d882875107086544477fe9e8253fa1 (patch)
tree4e1b2629fccdc4ca97f9b483921b0a6c6c637d58
parentf0095397fd8a61367d39ae76bf63fb1c48885bbc (diff)
downloadpuppet-samba-0717f95455d882875107086544477fe9e8253fa1.tar.gz
puppet-samba-0717f95455d882875107086544477fe9e8253fa1.tar.bz2
Ruby 1.8.7 doesn't preserve hash insertion order
-rw-r--r--spec/support/augeas.rb10
1 files 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