-
-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1210 from headius/spec_update_20241105
Spec update 20241105
- Loading branch information
Showing
80 changed files
with
1,891 additions
and
230 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -146,6 +146,7 @@ Prime | |
Private | ||
ProcFromMethod | ||
Psych | ||
RactorLocalSingleton | ||
REXML | ||
RUBY_SIGNALS | ||
RbReadline | ||
|
This file contains 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 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,4 +1,3 @@ | ||
# frozen_string_literal: true | ||
a = 'string' | ||
b = a | ||
c = b | ||
|
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require_relative '../../spec_helper' | ||
require_relative 'fixtures/classes' | ||
|
||
describe "Array#fetch_values" do | ||
before :each do | ||
@array = [:a, :b, :c] | ||
end | ||
|
||
ruby_version_is "3.4" do | ||
describe "with matched indexes" do | ||
it "returns the values for indexes" do | ||
@array.fetch_values(0).should == [:a] | ||
@array.fetch_values(0, 2).should == [:a, :c] | ||
end | ||
|
||
it "returns the values for indexes ordered in the order of the requested indexes" do | ||
@array.fetch_values(2, 0).should == [:c, :a] | ||
end | ||
end | ||
|
||
describe "with unmatched indexes" do | ||
it "raises a index error if no block is provided" do | ||
-> { @array.fetch_values(0, 1, 44) }.should raise_error(IndexError) | ||
end | ||
|
||
it "returns the default value from block" do | ||
@array.fetch_values(44) { |index| "`#{index}' is not found" }.should == ["`44' is not found"] | ||
@array.fetch_values(0, 44) { |index| "`#{index}' is not found" }.should == [:a, "`44' is not found"] | ||
end | ||
end | ||
|
||
describe "without keys" do | ||
it "returns an empty Array" do | ||
@array.fetch_values.should == [] | ||
end | ||
end | ||
|
||
it "tries to convert the passed argument to an Integer using #to_int" do | ||
obj = mock('to_int') | ||
obj.should_receive(:to_int).and_return(2) | ||
@array.fetch_values(obj).should == [:c] | ||
end | ||
|
||
it "raises a TypeError when the passed argument can't be coerced to Integer" do | ||
-> { [].fetch_values("cat") }.should raise_error(TypeError) | ||
end | ||
end | ||
end |
This file contains 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 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
Oops, something went wrong.