-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[Feature #20187] Skip examples for bundled gems at Ruby 3.4 #9960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3cdd89b
We shouldn't load bundled gems from `.bundle` directory.
hsbt a4ee566
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt 997197b
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt 9e27e96
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt 7761815
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt cee0d0e
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt be62a87
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt eaee270
Reapply spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4…
hsbt 3d41eab
Reapply version guards for Ruby 3.4
hsbt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,107 @@ | ||
require_relative '../../spec_helper' | ||
|
||
require 'bigdecimal' | ||
|
||
describe "Integer#coerce" do | ||
context "fixnum" do | ||
describe "when given a Fixnum" do | ||
it "returns an array containing two Fixnums" do | ||
1.coerce(2).should == [2, 1] | ||
1.coerce(2).map { |i| i.class }.should == [Integer, Integer] | ||
end | ||
end | ||
ruby_version_is ""..."3.4" do | ||
|
||
describe "when given a String" do | ||
it "raises an ArgumentError when trying to coerce with a non-number String" do | ||
-> { 1.coerce(":)") }.should raise_error(ArgumentError) | ||
require 'bigdecimal' | ||
|
||
describe "Integer#coerce" do | ||
context "fixnum" do | ||
describe "when given a Fixnum" do | ||
it "returns an array containing two Fixnums" do | ||
1.coerce(2).should == [2, 1] | ||
1.coerce(2).map { |i| i.class }.should == [Integer, Integer] | ||
end | ||
end | ||
|
||
it "returns an array containing two Floats" do | ||
1.coerce("2").should == [2.0, 1.0] | ||
1.coerce("-2").should == [-2.0, 1.0] | ||
describe "when given a String" do | ||
it "raises an ArgumentError when trying to coerce with a non-number String" do | ||
-> { 1.coerce(":)") }.should raise_error(ArgumentError) | ||
end | ||
|
||
it "returns an array containing two Floats" do | ||
1.coerce("2").should == [2.0, 1.0] | ||
1.coerce("-2").should == [-2.0, 1.0] | ||
end | ||
end | ||
end | ||
|
||
it "raises a TypeError when trying to coerce with nil" do | ||
-> { 1.coerce(nil) }.should raise_error(TypeError) | ||
end | ||
it "raises a TypeError when trying to coerce with nil" do | ||
-> { 1.coerce(nil) }.should raise_error(TypeError) | ||
end | ||
|
||
it "tries to convert the given Object into a Float by using #to_f" do | ||
(obj = mock('1.0')).should_receive(:to_f).and_return(1.0) | ||
2.coerce(obj).should == [1.0, 2.0] | ||
it "tries to convert the given Object into a Float by using #to_f" do | ||
(obj = mock('1.0')).should_receive(:to_f).and_return(1.0) | ||
2.coerce(obj).should == [1.0, 2.0] | ||
|
||
(obj = mock('0')).should_receive(:to_f).and_return('0') | ||
-> { 2.coerce(obj).should == [1.0, 2.0] }.should raise_error(TypeError) | ||
end | ||
(obj = mock('0')).should_receive(:to_f).and_return('0') | ||
-> { 2.coerce(obj).should == [1.0, 2.0] }.should raise_error(TypeError) | ||
end | ||
|
||
it "raises a TypeError when given an Object that does not respond to #to_f" do | ||
-> { 1.coerce(mock('x')) }.should raise_error(TypeError) | ||
-> { 1.coerce(1..4) }.should raise_error(TypeError) | ||
-> { 1.coerce(:test) }.should raise_error(TypeError) | ||
it "raises a TypeError when given an Object that does not respond to #to_f" do | ||
-> { 1.coerce(mock('x')) }.should raise_error(TypeError) | ||
-> { 1.coerce(1..4) }.should raise_error(TypeError) | ||
-> { 1.coerce(:test) }.should raise_error(TypeError) | ||
end | ||
end | ||
end | ||
|
||
context "bignum" do | ||
it "coerces other to a Bignum and returns [other, self] when passed a Fixnum" do | ||
a = bignum_value | ||
ary = a.coerce(2) | ||
context "bignum" do | ||
it "coerces other to a Bignum and returns [other, self] when passed a Fixnum" do | ||
a = bignum_value | ||
ary = a.coerce(2) | ||
|
||
ary[0].should be_kind_of(Integer) | ||
ary[1].should be_kind_of(Integer) | ||
ary.should == [2, a] | ||
end | ||
ary[0].should be_kind_of(Integer) | ||
ary[1].should be_kind_of(Integer) | ||
ary.should == [2, a] | ||
end | ||
|
||
it "returns [other, self] when passed a Bignum" do | ||
a = bignum_value | ||
b = bignum_value | ||
ary = a.coerce(b) | ||
it "returns [other, self] when passed a Bignum" do | ||
a = bignum_value | ||
b = bignum_value | ||
ary = a.coerce(b) | ||
|
||
ary[0].should be_kind_of(Integer) | ||
ary[1].should be_kind_of(Integer) | ||
ary.should == [b, a] | ||
end | ||
ary[0].should be_kind_of(Integer) | ||
ary[1].should be_kind_of(Integer) | ||
ary.should == [b, a] | ||
end | ||
|
||
it "raises a TypeError when not passed a Fixnum or Bignum" do | ||
a = bignum_value | ||
it "raises a TypeError when not passed a Fixnum or Bignum" do | ||
a = bignum_value | ||
|
||
-> { a.coerce(nil) }.should raise_error(TypeError) | ||
-> { a.coerce(mock('str')) }.should raise_error(TypeError) | ||
-> { a.coerce(1..4) }.should raise_error(TypeError) | ||
-> { a.coerce(:test) }.should raise_error(TypeError) | ||
end | ||
-> { a.coerce(nil) }.should raise_error(TypeError) | ||
-> { a.coerce(mock('str')) }.should raise_error(TypeError) | ||
-> { a.coerce(1..4) }.should raise_error(TypeError) | ||
-> { a.coerce(:test) }.should raise_error(TypeError) | ||
end | ||
|
||
it "coerces both values to Floats and returns [other, self] when passed a Float" do | ||
a = bignum_value | ||
a.coerce(1.2).should == [1.2, a.to_f] | ||
end | ||
it "coerces both values to Floats and returns [other, self] when passed a Float" do | ||
a = bignum_value | ||
a.coerce(1.2).should == [1.2, a.to_f] | ||
end | ||
|
||
it "coerces both values to Floats and returns [other, self] when passed a String" do | ||
a = bignum_value | ||
a.coerce("123").should == [123.0, a.to_f] | ||
end | ||
it "coerces both values to Floats and returns [other, self] when passed a String" do | ||
a = bignum_value | ||
a.coerce("123").should == [123.0, a.to_f] | ||
end | ||
|
||
it "calls #to_f to coerce other to a Float" do | ||
b = mock("bignum value") | ||
b.should_receive(:to_f).and_return(1.2) | ||
it "calls #to_f to coerce other to a Float" do | ||
b = mock("bignum value") | ||
b.should_receive(:to_f).and_return(1.2) | ||
|
||
a = bignum_value | ||
ary = a.coerce(b) | ||
a = bignum_value | ||
ary = a.coerce(b) | ||
|
||
ary.should == [1.2, a.to_f] | ||
ary.should == [1.2, a.to_f] | ||
end | ||
end | ||
end | ||
|
||
context "bigdecimal" do | ||
it "produces Floats" do | ||
x, y = 3.coerce(BigDecimal("3.4")) | ||
x.class.should == Float | ||
x.should == 3.4 | ||
y.class.should == Float | ||
y.should == 3.0 | ||
context "bigdecimal" do | ||
it "produces Floats" do | ||
x, y = 3.coerce(BigDecimal("3.4")) | ||
x.class.should == Float | ||
x.should == 3.4 | ||
y.class.should == Float | ||
y.should == 3.0 | ||
end | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
require_relative "../../spec_helper" | ||
require_relative '../../shared/rational/coerce' | ||
|
||
describe "Rational#coerce" do | ||
it_behaves_like :rational_coerce, :coerce | ||
ruby_version_is ""..."3.4" do | ||
require_relative '../../shared/rational/coerce' | ||
|
||
describe "Rational#coerce" do | ||
it_behaves_like :rational_coerce, :coerce | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
require_relative '../../spec_helper' | ||
require 'abbrev' | ||
|
||
#test both Abbrev.abbrev and Array#abbrev in | ||
#the same manner, as they're more or less aliases | ||
#of one another | ||
ruby_version_is ""..."3.4" do | ||
require 'abbrev' | ||
|
||
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}], | ||
["Array#abbrev", -> a { a.abbrev}] | ||
].each do |(name, func)| | ||
#test both Abbrev.abbrev and Array#abbrev in | ||
#the same manner, as they're more or less aliases | ||
#of one another | ||
|
||
describe name do | ||
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do | ||
func.call(['ruby', 'rules']).should == {"rub" => "ruby", | ||
"ruby" => "ruby", | ||
"rul" => "rules", | ||
"rule" => "rules", | ||
"rules" => "rules"} | ||
[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}], | ||
["Array#abbrev", -> a { a.abbrev}] | ||
].each do |(name, func)| | ||
|
||
func.call(["car", "cone"]).should == {"ca" => "car", | ||
"car" => "car", | ||
"co" => "cone", | ||
"con" => "cone", | ||
"cone" => "cone"} | ||
end | ||
describe name do | ||
it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do | ||
func.call(['ruby', 'rules']).should == {"rub" => "ruby", | ||
"ruby" => "ruby", | ||
"rul" => "rules", | ||
"rule" => "rules", | ||
"rules" => "rules"} | ||
|
||
func.call(["car", "cone"]).should == {"ca" => "car", | ||
"car" => "car", | ||
"co" => "cone", | ||
"con" => "cone", | ||
"cone" => "cone"} | ||
end | ||
|
||
it "returns an empty hash when called on an empty array" do | ||
func.call([]).should == {} | ||
it "returns an empty hash when called on an empty array" do | ||
func.call([]).should == {} | ||
end | ||
end | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
require_relative '../../spec_helper' | ||
|
||
require 'base64' | ||
ruby_version_is ""..."3.4" do | ||
|
||
describe "Base64#decode64" do | ||
it "returns the Base64-decoded version of the given string" do | ||
Base64.decode64("U2VuZCByZWluZm9yY2VtZW50cw==\n").should == "Send reinforcements" | ||
end | ||
require 'base64' | ||
|
||
it "returns the Base64-decoded version of the given shared string" do | ||
Base64.decode64("base64: U2VuZCByZWluZm9yY2VtZW50cw==\n".split(" ").last).should == "Send reinforcements" | ||
end | ||
describe "Base64#decode64" do | ||
it "returns the Base64-decoded version of the given string" do | ||
Base64.decode64("U2VuZCByZWluZm9yY2VtZW50cw==\n").should == "Send reinforcements" | ||
end | ||
|
||
it "returns the Base64-decoded version of the given string with wrong padding" do | ||
Base64.decode64("XU2VuZCByZWluZm9yY2VtZW50cw===").should == "]M\x95\xB9\x90\x81\xC9\x95\xA5\xB9\x99\xBD\xC9\x8D\x95\xB5\x95\xB9\xD1\xCC".b | ||
end | ||
it "returns the Base64-decoded version of the given shared string" do | ||
Base64.decode64("base64: U2VuZCByZWluZm9yY2VtZW50cw==\n".split(" ").last).should == "Send reinforcements" | ||
end | ||
|
||
it "returns the Base64-decoded version of the given string that contains an invalid character" do | ||
Base64.decode64("%3D").should == "\xDC".b | ||
end | ||
it "returns the Base64-decoded version of the given string with wrong padding" do | ||
Base64.decode64("XU2VuZCByZWluZm9yY2VtZW50cw===").should == "]M\x95\xB9\x90\x81\xC9\x95\xA5\xB9\x99\xBD\xC9\x8D\x95\xB5\x95\xB9\xD1\xCC".b | ||
end | ||
|
||
it "returns a binary encoded string" do | ||
Base64.decode64("SEk=").encoding.should == Encoding::BINARY | ||
end | ||
it "returns the Base64-decoded version of the given string that contains an invalid character" do | ||
Base64.decode64("%3D").should == "\xDC".b | ||
end | ||
|
||
it "returns a binary encoded string" do | ||
Base64.decode64("SEk=").encoding.should == Encoding::BINARY | ||
end | ||
|
||
it "decodes without padding suffix ==" do | ||
Base64.decode64("eyJrZXkiOnsibiI6InR0dCJ9fQ").should == "{\"key\":{\"n\":\"ttt\"}}" | ||
it "decodes without padding suffix ==" do | ||
Base64.decode64("eyJrZXkiOnsibiI6InR0dCJ9fQ").should == "{\"key\":{\"n\":\"ttt\"}}" | ||
end | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
require_relative '../../spec_helper' | ||
|
||
require 'base64' | ||
ruby_version_is ""..."3.4" do | ||
|
||
describe "Base64#encode64" do | ||
it "returns the Base64-encoded version of the given string" do | ||
Base64.encode64("Now is the time for all good coders\nto learn Ruby").should == | ||
"Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g\nUnVieQ==\n" | ||
end | ||
require 'base64' | ||
|
||
it "returns the Base64-encoded version of the given string" do | ||
Base64.encode64('Send reinforcements').should == "U2VuZCByZWluZm9yY2VtZW50cw==\n" | ||
end | ||
describe "Base64#encode64" do | ||
it "returns the Base64-encoded version of the given string" do | ||
Base64.encode64("Now is the time for all good coders\nto learn Ruby").should == | ||
"Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g\nUnVieQ==\n" | ||
end | ||
|
||
it "returns the Base64-encoded version of the given shared string" do | ||
Base64.encode64("Now is the time for all good coders\nto learn Ruby".split("\n").last).should == | ||
"dG8gbGVhcm4gUnVieQ==\n" | ||
end | ||
it "returns the Base64-encoded version of the given string" do | ||
Base64.encode64('Send reinforcements').should == "U2VuZCByZWluZm9yY2VtZW50cw==\n" | ||
end | ||
|
||
it "returns the Base64-encoded version of the given shared string" do | ||
Base64.encode64("Now is the time for all good coders\nto learn Ruby".split("\n").last).should == | ||
"dG8gbGVhcm4gUnVieQ==\n" | ||
end | ||
|
||
it "returns a US_ASCII encoded string" do | ||
Base64.encode64("HI").encoding.should == Encoding::US_ASCII | ||
it "returns a US_ASCII encoded string" do | ||
Base64.encode64("HI").encoding.should == Encoding::US_ASCII | ||
end | ||
end | ||
end |
Oops, something went wrong.
3B04
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This disables all Integer#coerce specs, it's not OK.
Same for Rational#coerce specs below.