rosemary 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rosemary/node.rb CHANGED
@@ -53,9 +53,7 @@ module Rosemary
53
53
  # don't bother to compare more stuff if parent comparison failed
54
54
  return parent_compare unless parent_compare == 0
55
55
 
56
- tags_compare = self.send(:tags).sort <=> another_node.send(:tags).sort
57
- # don't bother to compare more stuff if tags comparison failed
58
- return tags_compare unless tags_compare == 0
56
+ return -1 if self.send(:tags) != another_node.send(:tags)
59
57
 
60
58
  0
61
59
  end
@@ -44,14 +44,12 @@ module Rosemary
44
44
  # don't bother to compare more stuff if parent comparison failed
45
45
  return parent_compare unless parent_compare == 0
46
46
 
47
+ return -1 if self.send(:tags) != another_relation.send(:tags)
48
+
47
49
  members_compare = self.send(:members).sort <=> another_relation.send(:members).sort
48
50
  # don't bother to compare more stuff if nodes comparison failed
49
51
  return members_compare unless members_compare == 0
50
52
 
51
- tags_compare = self.send(:tags).sort <=> another_relation.send(:tags).sort
52
- # don't bother to compare more stuff if tags comparison failed
53
- return tags_compare unless tags_compare == 0
54
-
55
53
  0
56
54
  end
57
55
 
@@ -1,4 +1,4 @@
1
1
  module Rosemary
2
2
  # The current version of this gem.
3
- VERSION = "0.3.8"
3
+ VERSION = "0.3.9"
4
4
  end
data/lib/rosemary/way.rb CHANGED
@@ -90,14 +90,12 @@ module Rosemary
90
90
  # don't bother to compare more stuff if parent comparison failed
91
91
  return parent_compare unless parent_compare == 0
92
92
 
93
+ return -1 if self.send(:tags) != another_way.send(:tags)
94
+
93
95
  nodes_compare = self.send(:nodes).sort <=> another_way.send(:nodes).sort
94
96
  # don't bother to compare more stuff if nodes comparison failed
95
97
  return nodes_compare unless nodes_compare == 0
96
98
 
97
- tags_compare = self.send(:tags).sort <=> another_way.send(:tags).sort
98
- # don't bother to compare more stuff if tags comparison failed
99
- return tags_compare unless tags_compare == 0
100
-
101
99
  0
102
100
  end
103
101
  end
@@ -115,53 +115,53 @@ describe Node do
115
115
  end
116
116
 
117
117
  it "should compare identity depending on tags and attributes" do
118
- first_node = Way.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
118
+ first_node = Node.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
119
119
  first_node.tags[:name] = 'Black horse'
120
- second_node = Way.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
120
+ second_node = Node.new('id' => 123, 'changeset' => '123', 'version' => 1, 'user' => 'horst', 'uid' => '123', 'timestamp' => '2005-07-30T14:27:12+01:00')
121
121
  second_node.tags[:name] = 'Black horse'
122
- first_node.should == second_node
122
+ (first_node <=> second_node).should == 0
123
123
  end
124
124
 
125
125
  it "should not be equal when id does not match" do
126
- first_node = Way.new('id' => 123)
127
- second_node = Way.new('id' => 234)
126
+ first_node = Node.new('id' => 123)
127
+ second_node = Node.new('id' => 234)
128
128
  first_node.should_not == second_node
129
129
  end
130
130
 
131
131
  it "should not be equal when changeset does not match" do
132
- first_node = Way.new('changeset' => 123)
133
- second_node = Way.new('changeset' => 234)
132
+ first_node = Node.new('changeset' => 123)
133
+ second_node = Node.new('changeset' => 234)
134
134
  first_node.should_not == second_node
135
135
  end
136
136
 
137
137
  it "should not be equal when version does not match" do
138
- first_node = Way.new('version' => 1)
139
- second_node = Way.new('version' => 2)
138
+ first_node = Node.new('version' => 1)
139
+ second_node = Node.new('version' => 2)
140
140
  first_node.should_not == second_node
141
141
  end
142
142
 
143
143
  it "should not be equal when user does not match" do
144
- first_node = Way.new('user' => 'horst')
145
- second_node = Way.new('user' => 'jack')
144
+ first_node = Node.new('user' => 'horst')
145
+ second_node = Node.new('user' => 'jack')
146
146
  first_node.should_not == second_node
147
147
  end
148
148
 
149
149
  it "should not be equal when uid does not match" do
150
- first_node = Way.new('uid' => 123)
151
- second_node = Way.new('uid' => 234)
150
+ first_node = Node.new('uid' => 123)
151
+ second_node = Node.new('uid' => 234)
152
152
  first_node.should_not == second_node
153
153
  end
154
154
 
155
155
  it "should not be equal when timestamp does not match" do
156
- first_node = Way.new('timestamp' => '2005-07-30T14:27:12+01:00')
157
- second_node = Way.new('timestamp' => '2006-07-30T14:27:12+01:00')
156
+ first_node = Node.new('timestamp' => '2005-07-30T14:27:12+01:00')
157
+ second_node = Node.new('timestamp' => '2006-07-30T14:27:12+01:00')
158
158
  first_node.should_not == second_node
159
159
  end
160
160
 
161
161
  it "should not be equal when tags do not match" do
162
- first_node = Way.new('id' => 123)
162
+ first_node = Node.new('id' => 123)
163
163
  first_node.tags[:name] = 'black horse'
164
- second_node = Way.new('id' => 123)
164
+ second_node = Node.new('id' => 123)
165
165
  second_node.tags[:name] = 'white horse'
166
166
  first_node.should_not == second_node
167
167
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosemary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -241,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  segments:
243
243
  - 0
244
- hash: -3489737723584128145
244
+ hash: 4362026444618257339
245
245
  required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  none: false
247
247
  requirements: