2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../../spec_helper'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-09-15 21:54:31 +02:00
|
|
|
ruby_version_is ''...'3.0' do
|
2020-01-12 08:14:26 +09:00
|
|
|
require 'rexml/document'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
describe "REXML::Text#<=>" do
|
|
|
|
before :each do
|
|
|
|
@first = REXML::Text.new("abc")
|
|
|
|
@last = REXML::Text.new("def")
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
it "returns -1 if lvalue is less than rvalue" do
|
|
|
|
val = @first <=> @last
|
|
|
|
val.should == -1
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns -1 if lvalue is greater than rvalue" do
|
|
|
|
val = @last <=> @first
|
|
|
|
val.should == 1
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-01-12 08:14:26 +09:00
|
|
|
it "returns 0 if both values are equal" do
|
|
|
|
tmp = REXML::Text.new("tmp")
|
|
|
|
val = tmp <=> tmp
|
|
|
|
val.should == 0
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
end
|
|
|
|
end
|