Skip to content

Commit

Permalink
standard.rb: Avoid ambiguous - operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Apr 15, 2019
1 parent 9e28ec7 commit c6ac130
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec/chunky_png/point_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@

describe '#<=>' do
it "should return 0 if the coordinates are identical" do
expect((subject <=> ChunkyPNG::Point.new(1, 2))).to eql 0
expect((subject <=> ChunkyPNG::Point.new(1, 2))).to eql(0)
end

it "should return -1 if the y coordinate is smaller than the other one" do
expect((subject <=> ChunkyPNG::Point.new(1, 3))).to eql -1
expect((subject <=> ChunkyPNG::Point.new(0, 3))).to eql -1 # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(2, 3))).to eql -1 # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(1, 3))).to eql(-1)
expect((subject <=> ChunkyPNG::Point.new(0, 3))).to eql(-1) # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(2, 3))).to eql(-1) # x doesn't matter
end

it "should return 1 if the y coordinate is larger than the other one" do
expect((subject <=> ChunkyPNG::Point.new(1, 0))).to eql 1
expect((subject <=> ChunkyPNG::Point.new(0, 0))).to eql 1 # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(2, 0))).to eql 1 # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(1, 0))).to eql(1)
expect((subject <=> ChunkyPNG::Point.new(0, 0))).to eql(1) # x doesn't matter
expect((subject <=> ChunkyPNG::Point.new(2, 0))).to eql(1) # x doesn't matter
end

it "should return -1 if the x coordinate is smaller and y is the same" do
expect((subject <=> ChunkyPNG::Point.new(2, 2))).to eql -1
expect((subject <=> ChunkyPNG::Point.new(2, 2))).to eql(-1)
end

it "should return 1 if the x coordinate is larger and y is the same" do
expect((subject <=> ChunkyPNG::Point.new(0, 2))).to eql 1
expect((subject <=> ChunkyPNG::Point.new(0, 2))).to eql(1)
end
end
end
Expand Down

0 comments on commit c6ac130

Please sign in to comment.