File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
module GeoPattern
2
2
class SVG
3
+ include Comparable
4
+
3
5
def initialize
4
6
@width = 100
5
7
@height = 100
@@ -67,5 +69,9 @@ def write_args(args)
67
69
def self . as_comment ( str )
68
70
"<!-- #{ str } -->"
69
71
end
72
+
73
+ def <=>( other )
74
+ to_s <=> other . to_s
75
+ end
70
76
end
71
77
end
Original file line number Diff line number Diff line change 14
14
# Loading support files
15
15
Dir . glob ( ::File . expand_path ( '../support/*.rb' , __FILE__ ) ) . each { |f | require_relative f }
16
16
Dir . glob ( ::File . expand_path ( '../shared_examples/*.rb' , __FILE__ ) ) . each { |f | require_relative f }
17
+
18
+ # No need to add the namespace to every class tested
19
+ include GeoPattern
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ RSpec . describe SVG do
4
+ context '#<=>' do
5
+ it 'is comparable' do
6
+ svg1 = SVG . new
7
+ svg2 = SVG . new
8
+
9
+ expect ( svg1 ) . to eq svg2
10
+ end
11
+ end
12
+ end
You can’t perform that action at this time.
0 commit comments