version: allow implicitly converting tokens to strings
This commit is contained in:
parent
49fa3cc75d
commit
4377a08b6e
@ -38,6 +38,12 @@ describe Version::Token do
|
|||||||
expect(v <=> Object.new).to be nil
|
expect(v <=> Object.new).to be nil
|
||||||
expect { v > Object.new }.to raise_error(ArgumentError)
|
expect { v > Object.new }.to raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#to_str" do
|
||||||
|
it "implicitly converts token to string" do
|
||||||
|
expect(String.try_convert(described_class.new("foo"))).not_to be nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Version::NULL do
|
describe Version::NULL do
|
||||||
|
@ -65,6 +65,7 @@ class Version
|
|||||||
def to_s
|
def to_s
|
||||||
value.to_s
|
value.to_s
|
||||||
end
|
end
|
||||||
|
alias to_str to_s
|
||||||
|
|
||||||
def numeric?
|
def numeric?
|
||||||
false
|
false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user