-
-
Notifications
You must be signed in to change notification settings - Fork 396
Fewer shared specs for library #1371
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
Merged
+2,675
−3,011
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8a7eb3c
Move BigDecimal to rely less on shared examples
Earlopain 8352bf6
Move Date to rely less on shared examples
Earlopain 0f8e805
Move DateTime to rely less on shared examples
Earlopain 48c27ea
Move Digest to rely less on shared examples
Earlopain d7dbdb7
Move GetoptLong to rely less on shared examples
Earlopain 3bf5a2f
Move Matrix to rely less on shared examples
Earlopain bfeea7a
Move Net::HTTP to rely less on shared examples
Earlopain 7c4b269
Move OpenStruct to rely less on shared examples
Earlopain c1a5636
Move Pathname to rely less on shared examples
Earlopain b0d6fb4
Move Prime to rely less on shared examples
Earlopain 459abee
Move Socket to rely less on shared examples
Earlopain ddd8fe8
Move StringIO to rely less on shared examples
Earlopain 37807f7
Move StringScanner to rely less on shared examples
Earlopain 7731cc0
Move Syslog to rely less on shared examples
Earlopain 42d5768
Move Tempfile to rely less on shared examples
Earlopain 6f1e5e8
Move Time to rely less on shared examples
Earlopain 6831440
Move URI to rely less on shared examples
Earlopain 5224b3c
Move YAML to rely less on shared examples
Earlopain 4ecd9dd
Fixes for :library alias specs
eregon 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/eql' | ||
| require 'bigdecimal' | ||
|
|
||
|
|
||
| describe "BigDecimal#===" do | ||
| it_behaves_like :bigdecimal_eql, :=== | ||
| it "is an alias of BigDecimal#==" do | ||
| BigDecimal.instance_method(:===).should == BigDecimal.instance_method(:==) | ||
| 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,8 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/clone' | ||
| require 'bigdecimal' | ||
|
|
||
| describe "BigDecimal#dup" do | ||
| it_behaves_like :bigdecimal_clone, :clone | ||
| describe "BigDecimal#clone" do | ||
| it "is an alias of BigDecimal#dup" do | ||
| BigDecimal.instance_method(:clone).should == BigDecimal.instance_method(:dup) | ||
| 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,14 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/clone' | ||
| require 'bigdecimal' | ||
|
|
||
| describe "BigDecimal#dup" do | ||
| it_behaves_like :bigdecimal_clone, :dup | ||
| before :each do | ||
| @obj = BigDecimal("1.2345") | ||
| end | ||
|
|
||
| it "returns self" do | ||
| copy = @obj.dup | ||
|
|
||
| copy.should.equal?(@obj) | ||
| 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,8 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/eql' | ||
| require 'bigdecimal' | ||
|
|
||
| describe "BigDecimal#eql?" do | ||
| it_behaves_like :bigdecimal_eql, :eql? | ||
| it "is an alias of BigDecimal#==" do | ||
| BigDecimal.instance_method(:eql?).should == BigDecimal.instance_method(:==) | ||
| 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,7 +1,63 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/eql' | ||
| require 'bigdecimal' | ||
|
|
||
|
|
||
| describe "BigDecimal#==" do | ||
| it_behaves_like :bigdecimal_eql, :== | ||
| before :each do | ||
| @bg6543_21 = BigDecimal("6543.21") | ||
| @bg5667_19 = BigDecimal("5667.19") | ||
| @a = BigDecimal("1.0000000000000000000000000000000000000000005") | ||
| @b = BigDecimal("1.00000000000000000000000000000000000000000005") | ||
| @bigint = BigDecimal("1000.0") | ||
| @nan = BigDecimal("NaN") | ||
| @infinity = BigDecimal("Infinity") | ||
| @infinity_minus = BigDecimal("-Infinity") | ||
| end | ||
|
|
||
| it "tests for equality" do | ||
| (@bg6543_21 == @bg6543_21).should == true | ||
| (@a == @a).should == true | ||
| (@a == @b).should == false | ||
| (@bg6543_21 == @a).should == false | ||
| (@bigint == 1000).should == true | ||
| end | ||
|
|
||
| it "returns false for NaN as it is never equal to any number" do | ||
| (@nan == @nan).should == false | ||
| (@a == @nan).should == false | ||
| (@nan == @a).should == false | ||
| (@nan == @infinity).should == false | ||
| (@nan == @infinity_minus).should == false | ||
| (@infinity == @nan).should == false | ||
| (@infinity_minus == @nan).should == false | ||
| end | ||
|
|
||
| it "returns true for infinity values with the same sign" do | ||
| (@infinity == @infinity).should == true | ||
| (@infinity == BigDecimal("Infinity")).should == true | ||
| (BigDecimal("Infinity") == @infinity).should == true | ||
|
|
||
| (@infinity_minus == @infinity_minus).should == true | ||
| (@infinity_minus == BigDecimal("-Infinity")).should == true | ||
| (BigDecimal("-Infinity") == @infinity_minus).should == true | ||
| end | ||
|
|
||
| it "returns false for infinity values with different signs" do | ||
| (@infinity == @infinity_minus).should == false | ||
| (@infinity_minus == @infinity).should == false | ||
| end | ||
|
|
||
| it "returns false when infinite value compared to finite one" do | ||
| (@infinity == @a).should == false | ||
| (@infinity_minus == @a).should == false | ||
|
|
||
| (@a == @infinity).should == false | ||
| (@a == @infinity_minus).should == false | ||
| end | ||
|
|
||
| it "returns false when compared objects that can not be coerced into BigDecimal" do | ||
| (@infinity == nil).should == false | ||
| (@bigint == nil).should == false | ||
| (@nan == nil).should == false | ||
| 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,12 +1,21 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/modulo' | ||
| require 'bigdecimal' | ||
|
|
||
| describe "BigDecimal#%" do | ||
| it_behaves_like :bigdecimal_modulo, :% | ||
| it_behaves_like :bigdecimal_modulo_zerodivisionerror, :% | ||
|
|
||
| it "raises ZeroDivisionError if other is zero" do | ||
| bd5667 = BigDecimal("5667.19") | ||
|
|
||
| -> { bd5667 % 0 }.should.raise(ZeroDivisionError) | ||
| -> { bd5667 % BigDecimal("0") }.should.raise(ZeroDivisionError) | ||
| -> { @zero % @zero }.should.raise(ZeroDivisionError) | ||
| end | ||
| end | ||
|
|
||
| describe "BigDecimal#modulo" do | ||
| it_behaves_like :bigdecimal_modulo, :modulo | ||
| it_behaves_like :bigdecimal_modulo_zerodivisionerror, :modulo | ||
| it "is an alias of BigDecimal#%" do | ||
| BigDecimal.instance_method(:modulo).should == BigDecimal.instance_method(:%) | ||
| end | ||
| end | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,7 +1,17 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/to_int' | ||
| require 'bigdecimal' | ||
|
|
||
| describe "BigDecimal#to_i" do | ||
| it_behaves_like :bigdecimal_to_int, :to_i | ||
| it "raises FloatDomainError if BigDecimal is infinity or NaN" do | ||
| -> { BigDecimal("Infinity").to_i }.should.raise(FloatDomainError) | ||
| -> { BigDecimal("NaN").to_i }.should.raise(FloatDomainError) | ||
| end | ||
|
|
||
| it "returns Integer otherwise" do | ||
| BigDecimal("3E-20001").to_i.should == 0 | ||
| BigDecimal("2E4000").to_i.should == 2 * 10 ** 4000 | ||
| BigDecimal("2").to_i.should == 2 | ||
| BigDecimal("2E10").to_i.should == 20000000000 | ||
| BigDecimal("3.14159").to_i.should == 3 | ||
| 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,8 +1,8 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/to_int' | ||
| require 'bigdecimal' | ||
|
|
||
|
|
||
| describe "BigDecimal#to_int" do | ||
| it_behaves_like :bigdecimal_to_int, :to_int | ||
| it "is an alias of BigDecimal#to_i" do | ||
| BigDecimal.instance_method(:to_int).should == BigDecimal.instance_method(:to_i) | ||
| 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
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,15 +1,22 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/jd' | ||
| require 'date' | ||
|
|
||
| describe "Date#jd" do | ||
|
|
||
| it "determines the Julian day for a Date object" do | ||
| Date.civil(2008, 1, 16).jd.should == 2454482 | ||
| end | ||
|
|
||
| end | ||
|
|
||
| describe "Date.jd" do | ||
| it_behaves_like :date_jd, :jd | ||
| it "constructs a Date object if passed a Julian day" do | ||
| Date.jd(2454482).should == Date.civil(2008, 1, 16) | ||
| end | ||
|
|
||
| it "returns a Date object representing Julian day 0 (-4712-01-01) if no arguments passed" do | ||
| Date.jd.should == Date.civil(-4712, 1, 1) | ||
| end | ||
|
|
||
| it "constructs a Date object if passed a negative number" do | ||
| Date.jd(-1).should == Date.civil(-4713, 12, 31) | ||
| 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,7 +1,8 @@ | ||
| require_relative '../../spec_helper' | ||
| require_relative 'shared/month' | ||
| require 'date' | ||
|
|
||
| describe "Date#mon" do | ||
| it_behaves_like :date_month, :mon | ||
| it "is an alias of Date#month" do | ||
| Date.instance_method(:mon).should == Date.instance_method(:month) | ||
| end | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.