diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb index 38bcf00cb4..84200e31f3 100644 --- a/Library/Homebrew/test/version_spec.rb +++ b/Library/Homebrew/test/version_spec.rb @@ -38,6 +38,12 @@ describe Version::Token do expect(v <=> Object.new).to be nil expect { v > Object.new }.to raise_error(ArgumentError) 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 describe Version::NULL do diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index daa83bf73e..d8e8ee6ff2 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -65,6 +65,7 @@ class Version def to_s value.to_s end + alias to_str to_s def numeric? false