diff options
Diffstat (limited to 'spec/ruby/library')
74 files changed, 462 insertions, 104 deletions
diff --git a/spec/ruby/library/bigdecimal/case_compare_spec.rb b/spec/ruby/library/bigdecimal/case_compare_spec.rb index dcbde80e85..2cb7345d5a 100644 --- a/spec/ruby/library/bigdecimal/case_compare_spec.rb +++ b/spec/ruby/library/bigdecimal/case_compare_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/eql.rb', __FILE__) describe "BigDecimal#===" do - it_behaves_like(:bigdecimal_eql, :===) + it_behaves_like :bigdecimal_eql, :=== end diff --git a/spec/ruby/library/bigdecimal/eql_spec.rb b/spec/ruby/library/bigdecimal/eql_spec.rb index f3f525a7ba..5018b1d670 100644 --- a/spec/ruby/library/bigdecimal/eql_spec.rb +++ b/spec/ruby/library/bigdecimal/eql_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/eql.rb', __FILE__) describe "BigDecimal#eql?" do - it_behaves_like(:bigdecimal_eql, :eql?) + it_behaves_like :bigdecimal_eql, :eql? end diff --git a/spec/ruby/library/bigdecimal/equal_value_spec.rb b/spec/ruby/library/bigdecimal/equal_value_spec.rb index bd07217b98..bcffdfe58a 100644 --- a/spec/ruby/library/bigdecimal/equal_value_spec.rb +++ b/spec/ruby/library/bigdecimal/equal_value_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/eql.rb', __FILE__) describe "BigDecimal#==" do - it_behaves_like(:bigdecimal_eql, :==) + it_behaves_like :bigdecimal_eql, :== end diff --git a/spec/ruby/library/bigdecimal/exponent_spec.rb b/spec/ruby/library/bigdecimal/exponent_spec.rb index 6bb678d4ed..449c55d8fe 100644 --- a/spec/ruby/library/bigdecimal/exponent_spec.rb +++ b/spec/ruby/library/bigdecimal/exponent_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/power', __FILE__) require 'bigdecimal' describe "BigDecimal#**" do - it_behaves_like(:bigdecimal_power, :**) + it_behaves_like :bigdecimal_power, :** end describe "BigDecimal#exponent" do diff --git a/spec/ruby/library/bigdecimal/modulo_spec.rb b/spec/ruby/library/bigdecimal/modulo_spec.rb index 6feeb685eb..04919c4362 100644 --- a/spec/ruby/library/bigdecimal/modulo_spec.rb +++ b/spec/ruby/library/bigdecimal/modulo_spec.rb @@ -2,11 +2,11 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/modulo', __FILE__) describe "BigDecimal#%" do - it_behaves_like(:bigdecimal_modulo, :%) - it_behaves_like(:bigdecimal_modulo_zerodivisionerror, :%) + it_behaves_like :bigdecimal_modulo, :% + it_behaves_like :bigdecimal_modulo_zerodivisionerror, :% end describe "BigDecimal#modulo" do - it_behaves_like(:bigdecimal_modulo, :modulo) - it_behaves_like(:bigdecimal_modulo_zerodivisionerror, :modulo) + it_behaves_like :bigdecimal_modulo, :modulo + it_behaves_like :bigdecimal_modulo_zerodivisionerror, :modulo end diff --git a/spec/ruby/library/bigdecimal/power_spec.rb b/spec/ruby/library/bigdecimal/power_spec.rb index f2b1a9b5c8..c9aef58b12 100644 --- a/spec/ruby/library/bigdecimal/power_spec.rb +++ b/spec/ruby/library/bigdecimal/power_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/power', __FILE__) describe "BigDecimal#power" do - it_behaves_like(:bigdecimal_power, :power) + it_behaves_like :bigdecimal_power, :power end diff --git a/spec/ruby/library/bigdecimal/to_i_spec.rb b/spec/ruby/library/bigdecimal/to_i_spec.rb index 8db69003c5..4ec7b3ec7e 100644 --- a/spec/ruby/library/bigdecimal/to_i_spec.rb +++ b/spec/ruby/library/bigdecimal/to_i_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/to_int', __FILE__) require 'bigdecimal' describe "BigDecimal#to_i" do - it_behaves_like(:bigdecimal_to_int, :to_i) + it_behaves_like :bigdecimal_to_int, :to_i end diff --git a/spec/ruby/library/bigdecimal/to_int_spec.rb b/spec/ruby/library/bigdecimal/to_int_spec.rb index 56a60d4a03..abe8663a60 100644 --- a/spec/ruby/library/bigdecimal/to_int_spec.rb +++ b/spec/ruby/library/bigdecimal/to_int_spec.rb @@ -4,5 +4,5 @@ require 'bigdecimal' describe "BigDecimal#to_int" do - it_behaves_like(:bigdecimal_to_int, :to_int) + it_behaves_like :bigdecimal_to_int, :to_int end diff --git a/spec/ruby/library/cgi/http_header_spec.rb b/spec/ruby/library/cgi/http_header_spec.rb index 1960d009e4..0fb7033a68 100644 --- a/spec/ruby/library/cgi/http_header_spec.rb +++ b/spec/ruby/library/cgi/http_header_spec.rb @@ -4,5 +4,5 @@ require 'cgi' require File.expand_path('../shared/http_header', __FILE__) describe "CGI#http_header" do - it_behaves_like(:cgi_http_header, :http_header) + it_behaves_like :cgi_http_header, :http_header end diff --git a/spec/ruby/library/date/civil_spec.rb b/spec/ruby/library/date/civil_spec.rb index 36e790aecd..c0552e57a5 100644 --- a/spec/ruby/library/date/civil_spec.rb +++ b/spec/ruby/library/date/civil_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/civil', __FILE__) require 'date' describe "Date#civil" do - it_behaves_like(:date_civil, :civil) + it_behaves_like :date_civil, :civil end diff --git a/spec/ruby/library/date/commercial_spec.rb b/spec/ruby/library/date/commercial_spec.rb index bb6671eda1..c815de141c 100644 --- a/spec/ruby/library/date/commercial_spec.rb +++ b/spec/ruby/library/date/commercial_spec.rb @@ -4,7 +4,7 @@ require File.expand_path('../shared/commercial', __FILE__) describe "Date#commercial" do - it_behaves_like(:date_commercial, :commercial) + it_behaves_like :date_commercial, :commercial end diff --git a/spec/ruby/library/date/new_spec.rb b/spec/ruby/library/date/new_spec.rb index f468036a01..77bffd4876 100644 --- a/spec/ruby/library/date/new_spec.rb +++ b/spec/ruby/library/date/new_spec.rb @@ -4,5 +4,5 @@ require File.expand_path('../shared/civil', __FILE__) require File.expand_path('../shared/new_bang', __FILE__) describe "Date.new" do - it_behaves_like(:date_civil, :new) + it_behaves_like :date_civil, :new end diff --git a/spec/ruby/library/digest/md5/append_spec.rb b/spec/ruby/library/digest/md5/append_spec.rb index ad828c83c1..5c37981285 100644 --- a/spec/ruby/library/digest/md5/append_spec.rb +++ b/spec/ruby/library/digest/md5/append_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/constants', __FILE__) require File.expand_path('../shared/update', __FILE__) describe "Digest::MD5#<<" do - it_behaves_like(:md5_update, :<<) + it_behaves_like :md5_update, :<< end diff --git a/spec/ruby/library/digest/sha256/append_spec.rb b/spec/ruby/library/digest/sha256/append_spec.rb index 53e623743a..a776869692 100644 --- a/spec/ruby/library/digest/sha256/append_spec.rb +++ b/spec/ruby/library/digest/sha256/append_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/constants', __FILE__) require File.expand_path('../shared/update', __FILE__) describe "Digest::SHA256#<<" do - it_behaves_like(:sha256_update, :<<) + it_behaves_like :sha256_update, :<< end diff --git a/spec/ruby/library/digest/sha384/append_spec.rb b/spec/ruby/library/digest/sha384/append_spec.rb index d694812e85..6849bd0a9c 100644 --- a/spec/ruby/library/digest/sha384/append_spec.rb +++ b/spec/ruby/library/digest/sha384/append_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/constants', __FILE__) require File.expand_path('../shared/update', __FILE__) describe "Digest::SHA384#<<" do - it_behaves_like(:sha384_update, :<<) + it_behaves_like :sha384_update, :<< end diff --git a/spec/ruby/library/digest/sha512/append_spec.rb b/spec/ruby/library/digest/sha512/append_spec.rb index 642e565bf6..de471fa51f 100644 --- a/spec/ruby/library/digest/sha512/append_spec.rb +++ b/spec/ruby/library/digest/sha512/append_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/constants', __FILE__) require File.expand_path('../shared/update', __FILE__) describe "Digest::SHA512#<<" do - it_behaves_like(:sha512_update, :<<) + it_behaves_like :sha512_update, :<< end diff --git a/spec/ruby/library/etc/endgrent_spec.rb b/spec/ruby/library/etc/endgrent_spec.rb index 95f0dc05e3..4b9fd0d017 100644 --- a/spec/ruby/library/etc/endgrent_spec.rb +++ b/spec/ruby/library/etc/endgrent_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/windows', __FILE__) require 'etc' describe "Etc.endgrent" do - it_behaves_like(:etc_on_windows, :endgrent) + it_behaves_like :etc_on_windows, :endgrent end diff --git a/spec/ruby/library/etc/endpwent_spec.rb b/spec/ruby/library/etc/endpwent_spec.rb index 7ce8f1925b..8875f4387d 100644 --- a/spec/ruby/library/etc/endpwent_spec.rb +++ b/spec/ruby/library/etc/endpwent_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/windows', __FILE__) require 'etc' describe "Etc.endpwent" do - it_behaves_like(:etc_on_windows, :endpwent) + it_behaves_like :etc_on_windows, :endpwent end diff --git a/spec/ruby/library/etc/getgrent_spec.rb b/spec/ruby/library/etc/getgrent_spec.rb index 96225e351a..f0031b17ad 100644 --- a/spec/ruby/library/etc/getgrent_spec.rb +++ b/spec/ruby/library/etc/getgrent_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/windows', __FILE__) require 'etc' describe "Etc.getgrent" do - it_behaves_like(:etc_on_windows, :getgrent) + it_behaves_like :etc_on_windows, :getgrent end diff --git a/spec/ruby/library/etc/getpwent_spec.rb b/spec/ruby/library/etc/getpwent_spec.rb index 1c8057c9e5..635aa8a478 100644 --- a/spec/ruby/library/etc/getpwent_spec.rb +++ b/spec/ruby/library/etc/getpwent_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/windows', __FILE__) require 'etc' describe "Etc.getpwent" do - it_behaves_like(:etc_on_windows, :getpwent) + it_behaves_like :etc_on_windows, :getpwent end diff --git a/spec/ruby/library/etc/group_spec.rb b/spec/ruby/library/etc/group_spec.rb index 8b92cb7bf0..62596398e1 100644 --- a/spec/ruby/library/etc/group_spec.rb +++ b/spec/ruby/library/etc/group_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/windows', __FILE__) require 'etc' describe "Etc.group" do - it_behaves_like(:etc_on_windows, :group) + it_behaves_like :etc_on_windows, :group platform_is_not :windows do it "raises a RuntimeError for parallel iteration" do diff --git a/spec/ruby/library/fiber/transfer_spec.rb b/spec/ruby/library/fiber/transfer_spec.rb index ad501c1d74..541aafc29d 100644 --- a/spec/ruby/library/fiber/transfer_spec.rb +++ b/spec/ruby/library/fiber/transfer_spec.rb @@ -47,5 +47,42 @@ with_feature :fiber_library do fiber = Fiber.new { fiber.resume } lambda { fiber.transfer }.should raise_error(FiberError) end + + it "works if Fibers in different Threads each transfer to a Fiber in the same Thread" do + # This catches a bug where Fibers are running on a thread-pool + # and Fibers from a different Ruby Thread reuse the same native thread. + # Caching the Ruby Thread based on the native thread is not correct in that case, + # and the check for "fiber called across threads" in Fiber#transfer + # might be incorrect based on that. + 2.times do + Thread.new do + io_fiber = Fiber.new do |calling_fiber| + calling_fiber.transfer + end + io_fiber.transfer(Fiber.current) + value = Object.new + io_fiber.transfer(value).should equal value + end.join + end + end + + it "transfers control between a non-main thread's root fiber to a child fiber and back again" do + states = [] + thread = Thread.new do + f1 = Fiber.new do |f0| + states << 0 + value2 = f0.transfer(1) + states << value2 + 3 + end + + value1 = f1.transfer(Fiber.current) + states << value1 + value3 = f1.transfer(2) + states << value3 + end + thread.join + states.should == [0, 1, 2, 3] + end end end diff --git a/spec/ruby/library/getoptlong/each_option_spec.rb b/spec/ruby/library/getoptlong/each_option_spec.rb index c58815bfa9..7ad50f7ca3 100644 --- a/spec/ruby/library/getoptlong/each_option_spec.rb +++ b/spec/ruby/library/getoptlong/each_option_spec.rb @@ -3,5 +3,5 @@ require 'getoptlong' require File.expand_path('../shared/each', __FILE__) describe "GetoptLong#each_option" do - it_behaves_like(:getoptlong_each, :each_option) + it_behaves_like :getoptlong_each, :each_option end diff --git a/spec/ruby/library/getoptlong/each_spec.rb b/spec/ruby/library/getoptlong/each_spec.rb index d09f84a6db..ffd2e9d0c6 100644 --- a/spec/ruby/library/getoptlong/each_spec.rb +++ b/spec/ruby/library/getoptlong/each_spec.rb @@ -3,5 +3,5 @@ require 'getoptlong' require File.expand_path('../shared/each', __FILE__) describe "GetoptLong#each" do - it_behaves_like(:getoptlong_each, :each) + it_behaves_like :getoptlong_each, :each end diff --git a/spec/ruby/library/getoptlong/get_option_spec.rb b/spec/ruby/library/getoptlong/get_option_spec.rb index c56903e68e..e73c391ef4 100644 --- a/spec/ruby/library/getoptlong/get_option_spec.rb +++ b/spec/ruby/library/getoptlong/get_option_spec.rb @@ -3,5 +3,5 @@ require 'getoptlong' require File.expand_path('../shared/get', __FILE__) describe "GetoptLong#get_option" do - it_behaves_like(:getoptlong_get, :get_option) + it_behaves_like :getoptlong_get, :get_option end diff --git a/spec/ruby/library/getoptlong/get_spec.rb b/spec/ruby/library/getoptlong/get_spec.rb index ba1a1be6ad..ec1aae437c 100644 --- a/spec/ruby/library/getoptlong/get_spec.rb +++ b/spec/ruby/library/getoptlong/get_spec.rb @@ -3,5 +3,5 @@ require 'getoptlong' require File.expand_path('../shared/get', __FILE__) describe "GetoptLong#get" do - it_behaves_like(:getoptlong_get, :get) + it_behaves_like :getoptlong_get, :get end diff --git a/spec/ruby/library/matrix/I_spec.rb b/spec/ruby/library/matrix/I_spec.rb index f83cc3cec4..0253c6c11c 100644 --- a/spec/ruby/library/matrix/I_spec.rb +++ b/spec/ruby/library/matrix/I_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/identity', __FILE__) describe "Matrix.I" do - it_behaves_like(:matrix_identity, :I) + it_behaves_like :matrix_identity, :I end diff --git a/spec/ruby/library/matrix/antisymmetric_spec.rb b/spec/ruby/library/matrix/antisymmetric_spec.rb index e5b2d51758..56347a1a22 100644 --- a/spec/ruby/library/matrix/antisymmetric_spec.rb +++ b/spec/ruby/library/matrix/antisymmetric_spec.rb @@ -1,35 +1,37 @@ require File.expand_path('../../../spec_helper', __FILE__) require 'matrix' -describe "Matrix#antisymmetric?" do - it "returns true for an antisymmetric Matrix" do - Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric?.should be_true - end +ruby_version_is "2.6" do + describe "Matrix#antisymmetric?" do + it "returns true for an antisymmetric Matrix" do + Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric?.should be_true + end - it "returns true for a 0x0 empty matrix" do - Matrix.empty.antisymmetric?.should be_true - end + it "returns true for a 0x0 empty matrix" do + Matrix.empty.antisymmetric?.should be_true + end - it "returns false for non-antisymmetric matrices" do - [ - Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]], - Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]], # wrong diagonal element - Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]] # only signs wrong - ].each do |matrix| - matrix.antisymmetric?.should be_false + it "returns false for non-antisymmetric matrices" do + [ + Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]], + Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]], # wrong diagonal element + Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]] # only signs wrong + ].each do |matrix| + matrix.antisymmetric?.should be_false + end end - end - it "raises an error for rectangular matrices" do - [ - Matrix[[0], [0]], - Matrix[[0, 0]], - Matrix.empty(0, 2), - Matrix.empty(2, 0), - ].each do |rectangular_matrix| - lambda { - rectangular_matrix.antisymmetric? - }.should raise_error(Matrix::ErrDimensionMismatch) + it "raises an error for rectangular matrices" do + [ + Matrix[[0], [0]], + Matrix[[0, 0]], + Matrix.empty(0, 2), + Matrix.empty(2, 0), + ].each do |rectangular_matrix| + lambda { + rectangular_matrix.antisymmetric? + }.should raise_error(Matrix::ErrDimensionMismatch) + end end end end diff --git a/spec/ruby/library/matrix/collect_spec.rb b/spec/ruby/library/matrix/collect_spec.rb index 1830aed103..1c9d10130d 100644 --- a/spec/ruby/library/matrix/collect_spec.rb +++ b/spec/ruby/library/matrix/collect_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/collect', __FILE__) describe "Matrix#collect" do - it_behaves_like(:collect, :collect) + it_behaves_like :collect, :collect end diff --git a/spec/ruby/library/matrix/conj_spec.rb b/spec/ruby/library/matrix/conj_spec.rb index 33221f7055..cb07b0b0a8 100644 --- a/spec/ruby/library/matrix/conj_spec.rb +++ b/spec/ruby/library/matrix/conj_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/conjugate', __FILE__) describe "Matrix#conj" do - it_behaves_like(:matrix_conjugate, :conj) + it_behaves_like :matrix_conjugate, :conj end diff --git a/spec/ruby/library/matrix/conjugate_spec.rb b/spec/ruby/library/matrix/conjugate_spec.rb index fd19f7689c..596af61654 100644 --- a/spec/ruby/library/matrix/conjugate_spec.rb +++ b/spec/ruby/library/matrix/conjugate_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/conjugate', __FILE__) describe "Matrix#conjugate" do - it_behaves_like(:matrix_conjugate, :conjugate) + it_behaves_like :matrix_conjugate, :conjugate end diff --git a/spec/ruby/library/matrix/det_spec.rb b/spec/ruby/library/matrix/det_spec.rb index 698de34fd1..565dbc7f6d 100644 --- a/spec/ruby/library/matrix/det_spec.rb +++ b/spec/ruby/library/matrix/det_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/determinant', __FILE__) require 'matrix' describe "Matrix#det" do - it_behaves_like(:determinant, :det) + it_behaves_like :determinant, :det end diff --git a/spec/ruby/library/matrix/determinant_spec.rb b/spec/ruby/library/matrix/determinant_spec.rb index 9ad34c6fc3..6d1ec53ce3 100644 --- a/spec/ruby/library/matrix/determinant_spec.rb +++ b/spec/ruby/library/matrix/determinant_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/determinant', __FILE__) require 'matrix' describe "Matrix#determinant" do - it_behaves_like(:determinant, :determinant) + it_behaves_like :determinant, :determinant end diff --git a/spec/ruby/library/matrix/eql_spec.rb b/spec/ruby/library/matrix/eql_spec.rb index e76d26753a..c43c7a4216 100644 --- a/spec/ruby/library/matrix/eql_spec.rb +++ b/spec/ruby/library/matrix/eql_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/equal_value', __FILE__) require 'matrix' describe "Matrix#eql?" do - it_behaves_like(:equal, :eql?) + it_behaves_like :equal, :eql? it "returns false if some elements are == but not eql?" do Matrix[[1, 2],[3, 4]].eql?(Matrix[[1, 2],[3, 4.0]]).should be_false diff --git a/spec/ruby/library/matrix/equal_value_spec.rb b/spec/ruby/library/matrix/equal_value_spec.rb index e14a38b872..5378288930 100644 --- a/spec/ruby/library/matrix/equal_value_spec.rb +++ b/spec/ruby/library/matrix/equal_value_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/equal_value', __FILE__) require 'matrix' describe "Matrix#==" do - it_behaves_like(:equal, :==) + it_behaves_like :equal, :== it "returns true if some elements are == but not eql?" do Matrix[[1, 2],[3, 4]].should == Matrix[[1, 2],[3, 4.0]] diff --git a/spec/ruby/library/matrix/identity_spec.rb b/spec/ruby/library/matrix/identity_spec.rb index bc7df98dde..6060a60c85 100644 --- a/spec/ruby/library/matrix/identity_spec.rb +++ b/spec/ruby/library/matrix/identity_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/identity', __FILE__) describe "Matrix.identity" do - it_behaves_like(:matrix_identity, :identity) + it_behaves_like :matrix_identity, :identity end diff --git a/spec/ruby/library/matrix/imag_spec.rb b/spec/ruby/library/matrix/imag_spec.rb index 41083879e4..5caa7161f7 100644 --- a/spec/ruby/library/matrix/imag_spec.rb +++ b/spec/ruby/library/matrix/imag_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/imaginary', __FILE__) describe "Matrix#imag" do - it_behaves_like(:matrix_imaginary, :imag) + it_behaves_like :matrix_imaginary, :imag end diff --git a/spec/ruby/library/matrix/imaginary_spec.rb b/spec/ruby/library/matrix/imaginary_spec.rb index 2a05f1d5c3..90e478682a 100644 --- a/spec/ruby/library/matrix/imaginary_spec.rb +++ b/spec/ruby/library/matrix/imaginary_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/imaginary', __FILE__) describe "Matrix#imaginary" do - it_behaves_like(:matrix_imaginary, :imaginary) + it_behaves_like :matrix_imaginary, :imaginary end diff --git a/spec/ruby/library/matrix/inv_spec.rb b/spec/ruby/library/matrix/inv_spec.rb index 0491aa7b07..c0bfce2c44 100644 --- a/spec/ruby/library/matrix/inv_spec.rb +++ b/spec/ruby/library/matrix/inv_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../spec_helper', __FILE__) require File.expand_path('../shared/inverse', __FILE__) describe "Matrix#inv" do - it_behaves_like(:inverse, :inv) + it_behaves_like :inverse, :inv end diff --git a/spec/ruby/library/matrix/inverse_spec.rb b/spec/ruby/library/matrix/inverse_spec.rb index 33a1f2f5de..885962a666 100644 --- a/spec/ruby/library/matrix/inverse_spec.rb +++ b/spec/ruby/library/matrix/inverse_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../spec_helper', __FILE__) require File.expand_path('../shared/inverse', __FILE__) describe "Matrix#inverse" do - it_behaves_like(:inverse, :inverse) + it_behaves_like :inverse, :inverse end diff --git a/spec/ruby/library/matrix/map_spec.rb b/spec/ruby/library/matrix/map_spec.rb index e18ab6eb7a..834914d48d 100644 --- a/spec/ruby/library/matrix/map_spec.rb +++ b/spec/ruby/library/matrix/map_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/collect', __FILE__) describe "Matrix#map" do - it_behaves_like(:collect, :map) + it_behaves_like :collect, :map end diff --git a/spec/ruby/library/matrix/rect_spec.rb b/spec/ruby/library/matrix/rect_spec.rb index d0a3b2705b..0015445a4c 100644 --- a/spec/ruby/library/matrix/rect_spec.rb +++ b/spec/ruby/library/matrix/rect_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/rectangular', __FILE__) describe "Matrix#rect" do - it_behaves_like(:matrix_rectangular, :rect) + it_behaves_like :matrix_rectangular, :rect end diff --git a/spec/ruby/library/matrix/rectangular_spec.rb b/spec/ruby/library/matrix/rectangular_spec.rb index 7af446cb18..0f6555d10e 100644 --- a/spec/ruby/library/matrix/rectangular_spec.rb +++ b/spec/ruby/library/matrix/rectangular_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/rectangular', __FILE__) describe "Matrix#rectangular" do - it_behaves_like(:matrix_rectangular, :rectangular) + it_behaves_like :matrix_rectangular, :rectangular end diff --git a/spec/ruby/library/matrix/t_spec.rb b/spec/ruby/library/matrix/t_spec.rb index 1c57c25de3..68df5eae2e 100644 --- a/spec/ruby/library/matrix/t_spec.rb +++ b/spec/ruby/library/matrix/t_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/transpose', __FILE__) describe "Matrix#transpose" do - it_behaves_like(:matrix_transpose, :t) + it_behaves_like :matrix_transpose, :t end diff --git a/spec/ruby/library/matrix/tr_spec.rb b/spec/ruby/library/matrix/tr_spec.rb index 4b07a70203..cf0bdaaec9 100644 --- a/spec/ruby/library/matrix/tr_spec.rb +++ b/spec/ruby/library/matrix/tr_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/trace', __FILE__) require 'matrix' describe "Matrix#tr" do - it_behaves_like(:trace, :tr) + it_behaves_like :trace, :tr end diff --git a/spec/ruby/library/matrix/trace_spec.rb b/spec/ruby/library/matrix/trace_spec.rb index 08adb256c0..1c3251eac5 100644 --- a/spec/ruby/library/matrix/trace_spec.rb +++ b/spec/ruby/library/matrix/trace_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/trace', __FILE__) require 'matrix' describe "Matrix#trace" do - it_behaves_like(:trace, :trace) + it_behaves_like :trace, :trace end diff --git a/spec/ruby/library/matrix/transpose_spec.rb b/spec/ruby/library/matrix/transpose_spec.rb index 2a30a80efc..6c38a3d0cd 100644 --- a/spec/ruby/library/matrix/transpose_spec.rb +++ b/spec/ruby/library/matrix/transpose_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/transpose', __FILE__) describe "Matrix#transpose" do - it_behaves_like(:matrix_transpose, :transpose) + it_behaves_like :matrix_transpose, :transpose end diff --git a/spec/ruby/library/matrix/unit_spec.rb b/spec/ruby/library/matrix/unit_spec.rb index 058d719043..005a718d8e 100644 --- a/spec/ruby/library/matrix/unit_spec.rb +++ b/spec/ruby/library/matrix/unit_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/identity', __FILE__) describe "Matrix.unit" do - it_behaves_like(:matrix_identity, :unit) + it_behaves_like :matrix_identity, :unit end diff --git a/spec/ruby/library/net/ftp/initialize_spec.rb b/spec/ruby/library/net/ftp/initialize_spec.rb index 65105b8831..b33d345f32 100644 --- a/spec/ruby/library/net/ftp/initialize_spec.rb +++ b/spec/ruby/library/net/ftp/initialize_spec.rb @@ -88,4 +88,322 @@ describe "Net::FTP#initialize" do @ftp.send(:initialize, "localhost", "rubyspec", "rocks", "account") end end + + ruby_version_is '2.4' do + before :each do + @ftp.stub!(:login) + end + + describe 'when the host' do + describe 'is set' do + describe 'and port option' do + describe 'is set' do + it 'tries to connect to the host on the specified port' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ port: 8080 }) + @ftp.should_receive(:connect).with('localhost', 8080) + + @ftp.send(:initialize, 'localhost', options) + end + end + + describe 'is not set' do + it 'tries to connect to the host without a port' do + @ftp.should_receive(:connect).with("localhost", *@port_args) + + @ftp.send(:initialize, 'localhost') + end + end + end + + describe 'when the username option' do + describe 'is set' do + describe 'and the password option' do + describe 'is set' do + describe 'and the account option' do + describe 'is set' do + it 'tries to log in with the supplied parameters' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ username: 'a', password: 'topsecret', account: 'b' }) + @ftp.should_receive(:login).with('a', 'topsecret', 'b') + + @ftp.send(:initialize, 'localhost', options) + end + end + + describe 'is unset' do + it 'tries to log in with the supplied parameters' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ username: 'a', password: 'topsecret' }) + @ftp.should_receive(:login).with('a', 'topsecret', nil) + + @ftp.send(:initialize, 'localhost', options) + end + end + end + end + + describe 'is unset' do + describe 'and the account option' do + describe 'is set' do + it 'tries to log in with the supplied parameters' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ username: 'a', account: 'b' }) + @ftp.should_receive(:login).with('a', nil, 'b') + + @ftp.send(:initialize, 'localhost', options) + end + end + + describe 'is unset' do + it 'tries to log in with the supplied parameters' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ username: 'a'}) + @ftp.should_receive(:login).with('a', nil, nil) + + @ftp.send(:initialize, 'localhost', options) + end + end + end + end + end + end + + describe 'is not set' do + it 'does not try to log in' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({}) + @ftp.should_not_receive(:login) + + @ftp.send(:initialize, 'localhost', options) + end + end + end + end + + describe 'is unset' do + it 'does not try to connect' do + @ftp.should_not_receive(:connect) + + @ftp.send(:initialize) + end + + it 'does not try to log in' do + @ftp.should_not_receive(:login) + + @ftp.send(:initialize) + end + end + end + + describe 'when the passive option' do + describe 'is set' do + describe 'to true' do + it 'sets passive to true' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ passive: true }) + + @ftp.send(:initialize, nil, options) + @ftp.passive.should == true + end + end + + describe 'to false' do + it 'sets passive to false' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ passive: false }) + + @ftp.send(:initialize, nil, options) + @ftp.passive.should == false + end + end + end + + describe 'is unset' do + it 'sets passive to false' do + @ftp.send(:initialize) + @ftp.passive.should == false + end + end + end + + describe 'when the debug_mode option' do + describe 'is set' do + describe 'to true' do + it 'sets debug_mode to true' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ debug_mode: true }) + + @ftp.send(:initialize, nil, options) + @ftp.debug_mode.should == true + end + end + + describe 'to false' do + it 'sets debug_mode to false' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ debug_mode: false }) + + @ftp.send(:initialize, nil, options) + @ftp.debug_mode.should == false + end + end + end + + describe 'is unset' do + it 'sets debug_mode to false' do + @ftp.send(:initialize) + @ftp.debug_mode.should == false + end + end + end + + describe 'when the open_timeout option' do + describe 'is set' do + it 'sets open_timeout to the specified value' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ open_timeout: 42 }) + + @ftp.send(:initialize, nil, options) + @ftp.open_timeout.should == 42 + end + end + + describe 'is not set' do + it 'sets open_timeout to nil' do + @ftp.send(:initialize) + @ftp.open_timeout.should == nil + end + end + end + + describe 'when the read_timeout option' do + describe 'is set' do + it 'sets read_timeout to the specified value' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ read_timeout: 100 }) + + @ftp.send(:initialize, nil, options) + @ftp.read_timeout.should == 100 + end + end + + describe 'is not set' do + it 'sets read_timeout to the default value' do + @ftp.send(:initialize) + @ftp.read_timeout.should == 60 + end + end + end + + describe 'when the ssl_handshake_timeout option' do + describe 'is set' do + it 'sets ssl_handshake_timeout to the specified value' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ ssl_handshake_timeout: 23 }) + + @ftp.send(:initialize, nil, options) + @ftp.ssl_handshake_timeout.should == 23 + end + end + + describe 'is not set' do + it 'sets ssl_handshake_timeout to nil' do + @ftp.send(:initialize) + @ftp.ssl_handshake_timeout.should == nil + end + end + end + + describe 'when the ssl option' do + describe 'is set' do + describe "and the ssl option's value is true" do + it 'initializes ssl_context to a blank SSLContext object' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ ssl: true }) + + ssl_context = OpenSSL::SSL::SSLContext.allocate + ssl_context.stub!(:set_params) + + OpenSSL::SSL::SSLContext.should_receive(:new).and_return(ssl_context) + ssl_context.should_receive(:set_params).with({}) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@ssl_context).should == ssl_context + end + end + + describe "and the ssl option's value is a hash" do + it 'initializes ssl_context to a configured SSLContext object' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ ssl: {key: 'value'} }) + + ssl_context = OpenSSL::SSL::SSLContext.allocate + ssl_context.stub!(:set_params) + + OpenSSL::SSL::SSLContext.should_receive(:new).and_return(ssl_context) + ssl_context.should_receive(:set_params).with({key: 'value'}) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@ssl_context).should == ssl_context + end + end + + describe 'and private_data_connection' do + describe 'is set' do + it 'sets private_data_connection to that value' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ ssl: true, private_data_connection: 'true' }) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@private_data_connection).should == 'true' + end + end + + describe 'is not set' do + it 'sets private_data_connection to nil' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ ssl: true }) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@private_data_connection).should == true + end + end + end + end + + describe 'is not set' do + it 'sets ssl_context to nil' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({}) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@ssl_context).should == nil + end + + describe 'private_data_connection' do + describe 'is set' do + it 'raises an ArgumentError' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({ private_data_connection: true }) + + -> { + @ftp.send(:initialize, nil, options) + }.should raise_error(ArgumentError, /private_data_connection can be set to true only when ssl is enabled/) + end + end + + describe 'is not set' do + it 'sets private_data_connection to false' do + options = mock('ftp initialize options') + options.should_receive(:to_hash).and_return({}) + + @ftp.send(:initialize, nil, options) + @ftp.instance_variable_get(:@private_data_connection).should == false + end + end + end + end + end + end end diff --git a/spec/ruby/library/rexml/document/add_spec.rb b/spec/ruby/library/rexml/document/add_spec.rb index 491c28259b..484731fe9b 100644 --- a/spec/ruby/library/rexml/document/add_spec.rb +++ b/spec/ruby/library/rexml/document/add_spec.rb @@ -49,9 +49,9 @@ describe :rexml_document_add, shared: true do end describe "REXML::Document#add" do - it_behaves_like(:rexml_document_add, :add) + it_behaves_like :rexml_document_add, :add end describe "REXML::Document#<<" do - it_behaves_like(:rexml_document_add, :<<) + it_behaves_like :rexml_document_add, :<< end diff --git a/spec/ruby/library/rexml/document/expanded_name_spec.rb b/spec/ruby/library/rexml/document/expanded_name_spec.rb index e18fd95c14..182f49eddd 100644 --- a/spec/ruby/library/rexml/document/expanded_name_spec.rb +++ b/spec/ruby/library/rexml/document/expanded_name_spec.rb @@ -8,9 +8,9 @@ describe :document_expanded_name, shared: true do end describe "REXML::Document#expanded_name" do - it_behaves_like(:document_expanded_name, :expanded_name) + it_behaves_like :document_expanded_name, :expanded_name end describe "REXML::Document#name" do - it_behaves_like(:document_expanded_name, :name) + it_behaves_like :document_expanded_name, :name end diff --git a/spec/ruby/library/scanf/io/block_scanf_spec.rb b/spec/ruby/library/scanf/io/block_scanf_spec.rb index 0f6188f91c..aee6459199 100644 --- a/spec/ruby/library/scanf/io/block_scanf_spec.rb +++ b/spec/ruby/library/scanf/io/block_scanf_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/block_scanf.rb', __FILE__) require 'scanf' describe "IO#block_scanf" do - it_behaves_like(:scanf_io_block_scanf, :block_scanf) + it_behaves_like :scanf_io_block_scanf, :block_scanf end diff --git a/spec/ruby/library/scanf/io/scanf_spec.rb b/spec/ruby/library/scanf/io/scanf_spec.rb index 27c3142678..7752036c09 100644 --- a/spec/ruby/library/scanf/io/scanf_spec.rb +++ b/spec/ruby/library/scanf/io/scanf_spec.rb @@ -31,5 +31,5 @@ describe "IO#scanf" do end describe "IO#scanf with block" do - it_behaves_like(:scanf_io_block_scanf, :scanf) + it_behaves_like :scanf_io_block_scanf, :scanf end diff --git a/spec/ruby/library/scanf/string/block_scanf_spec.rb b/spec/ruby/library/scanf/string/block_scanf_spec.rb index 1444cc2975..9dc5b52a84 100644 --- a/spec/ruby/library/scanf/string/block_scanf_spec.rb +++ b/spec/ruby/library/scanf/string/block_scanf_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/block_scanf.rb', __FILE__) require 'scanf' describe "String#block_scanf" do - it_behaves_like(:scanf_string_block_scanf, :block_scanf) + it_behaves_like :scanf_string_block_scanf, :block_scanf end diff --git a/spec/ruby/library/scanf/string/scanf_spec.rb b/spec/ruby/library/scanf/string/scanf_spec.rb index 360c72fba8..885361d5af 100644 --- a/spec/ruby/library/scanf/string/scanf_spec.rb +++ b/spec/ruby/library/scanf/string/scanf_spec.rb @@ -49,5 +49,5 @@ describe "String#scanf" do end describe "String#scanf with block" do - it_behaves_like(:scanf_string_block_scanf, :scanf) + it_behaves_like :scanf_string_block_scanf, :scanf end diff --git a/spec/ruby/library/socket/addrinfo/to_s_spec.rb b/spec/ruby/library/socket/addrinfo/to_s_spec.rb index 7205bdc823..3d2072fe02 100644 --- a/spec/ruby/library/socket/addrinfo/to_s_spec.rb +++ b/spec/ruby/library/socket/addrinfo/to_s_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/to_sockaddr', __FILE__) require 'socket' describe "Addrinfo#to_s" do - it_behaves_like(:socket_addrinfo_to_sockaddr, :to_s) + it_behaves_like :socket_addrinfo_to_sockaddr, :to_s end diff --git a/spec/ruby/library/socket/addrinfo/to_sockaddr_spec.rb b/spec/ruby/library/socket/addrinfo/to_sockaddr_spec.rb index f3f926c2b6..cbe7c903aa 100644 --- a/spec/ruby/library/socket/addrinfo/to_sockaddr_spec.rb +++ b/spec/ruby/library/socket/addrinfo/to_sockaddr_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/to_sockaddr', __FILE__) require 'socket' describe "Addrinfo#to_sockaddr" do - it_behaves_like(:socket_addrinfo_to_sockaddr, :to_sockaddr) + it_behaves_like :socket_addrinfo_to_sockaddr, :to_sockaddr end diff --git a/spec/ruby/library/stringio/codepoints_spec.rb b/spec/ruby/library/stringio/codepoints_spec.rb index 098bd3c4c3..5e6fa681e7 100644 --- a/spec/ruby/library/stringio/codepoints_spec.rb +++ b/spec/ruby/library/stringio/codepoints_spec.rb @@ -5,5 +5,5 @@ require File.expand_path('../shared/codepoints', __FILE__) # See redmine #1667 describe "StringIO#codepoints" do - it_behaves_like(:stringio_codepoints, :codepoints) + it_behaves_like :stringio_codepoints, :codepoints end diff --git a/spec/ruby/library/stringio/each_codepoint_spec.rb b/spec/ruby/library/stringio/each_codepoint_spec.rb index 25a0bf4c81..8351bf4175 100644 --- a/spec/ruby/library/stringio/each_codepoint_spec.rb +++ b/spec/ruby/library/stringio/each_codepoint_spec.rb @@ -5,6 +5,6 @@ require File.expand_path('../shared/codepoints', __FILE__) # See redmine #1667 describe "StringIO#each_codepoint" do - it_behaves_like(:stringio_codepoints, :codepoints) + it_behaves_like :stringio_codepoints, :codepoints end diff --git a/spec/ruby/library/stringscanner/beginning_of_line_spec.rb b/spec/ruby/library/stringscanner/beginning_of_line_spec.rb index 192a83f2c9..f4e820e099 100644 --- a/spec/ruby/library/stringscanner/beginning_of_line_spec.rb +++ b/spec/ruby/library/stringscanner/beginning_of_line_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/bol.rb', __FILE__) require 'strscan' describe "StringScanner#beginning_of_line?" do - it_behaves_like(:strscan_bol, :beginning_of_line?) + it_behaves_like :strscan_bol, :beginning_of_line? end diff --git a/spec/ruby/library/stringscanner/bol_spec.rb b/spec/ruby/library/stringscanner/bol_spec.rb index ee5257529a..17a8c1cbff 100644 --- a/spec/ruby/library/stringscanner/bol_spec.rb +++ b/spec/ruby/library/stringscanner/bol_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/bol.rb', __FILE__) require 'strscan' describe "StringScanner#bol?" do - it_behaves_like(:strscan_bol, :bol?) + it_behaves_like :strscan_bol, :bol? end diff --git a/spec/ruby/library/stringscanner/clear_spec.rb b/spec/ruby/library/stringscanner/clear_spec.rb index 81b2e68897..3ab0955819 100644 --- a/spec/ruby/library/stringscanner/clear_spec.rb +++ b/spec/ruby/library/stringscanner/clear_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/terminate.rb', __FILE__) require 'strscan' describe "StringScanner#clear" do - it_behaves_like(:strscan_terminate, :clear) + it_behaves_like :strscan_terminate, :clear it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") diff --git a/spec/ruby/library/stringscanner/concat_spec.rb b/spec/ruby/library/stringscanner/concat_spec.rb index dccc7d0efd..2f3e7d1694 100644 --- a/spec/ruby/library/stringscanner/concat_spec.rb +++ b/spec/ruby/library/stringscanner/concat_spec.rb @@ -3,9 +3,9 @@ require File.expand_path('../shared/concat.rb', __FILE__) require 'strscan' describe "StringScanner#concat" do - it_behaves_like(:strscan_concat, :concat) + it_behaves_like :strscan_concat, :concat end describe "StringScanner#concat when passed a Fixnum" do - it_behaves_like(:strscan_concat_fixnum, :concat) + it_behaves_like :strscan_concat_fixnum, :concat end diff --git a/spec/ruby/library/stringscanner/empty_spec.rb b/spec/ruby/library/stringscanner/empty_spec.rb index ebbc2c2703..c6b9444215 100644 --- a/spec/ruby/library/stringscanner/empty_spec.rb +++ b/spec/ruby/library/stringscanner/empty_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/eos.rb', __FILE__) require 'strscan' describe "StringScanner#empty?" do - it_behaves_like(:strscan_eos, :empty?) + it_behaves_like :strscan_eos, :empty? it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") diff --git a/spec/ruby/library/stringscanner/eos_spec.rb b/spec/ruby/library/stringscanner/eos_spec.rb index 3fdeceb25d..3016a3fc52 100644 --- a/spec/ruby/library/stringscanner/eos_spec.rb +++ b/spec/ruby/library/stringscanner/eos_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/eos.rb', __FILE__) require 'strscan' describe "StringScanner#eos?" do - it_behaves_like(:strscan_eos, :eos?) + it_behaves_like :strscan_eos, :eos? end diff --git a/spec/ruby/library/stringscanner/matched_size_spec.rb b/spec/ruby/library/stringscanner/matched_size_spec.rb index 7aac71878a..641d530be4 100644 --- a/spec/ruby/library/stringscanner/matched_size_spec.rb +++ b/spec/ruby/library/stringscanner/matched_size_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/matched_size.rb', __FILE__) require 'strscan' describe "StringScanner#matched_size" do - it_behaves_like(:strscan_matched_size, :matched_size) + it_behaves_like :strscan_matched_size, :matched_size end diff --git a/spec/ruby/library/stringscanner/peek_spec.rb b/spec/ruby/library/stringscanner/peek_spec.rb index 49490ec3da..af40dbcb42 100644 --- a/spec/ruby/library/stringscanner/peek_spec.rb +++ b/spec/ruby/library/stringscanner/peek_spec.rb @@ -3,6 +3,6 @@ require File.expand_path('../shared/peek.rb', __FILE__) require 'strscan' describe "StringScanner#peek" do - it_behaves_like(:strscan_peek, :peek) + it_behaves_like :strscan_peek, :peek end diff --git a/spec/ruby/library/stringscanner/peep_spec.rb b/spec/ruby/library/stringscanner/peep_spec.rb index 677c6f8a21..1b1864c340 100644 --- a/spec/ruby/library/stringscanner/peep_spec.rb +++ b/spec/ruby/library/stringscanner/peep_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/peek.rb', __FILE__) require 'strscan' describe "StringScanner#peep" do - it_behaves_like(:strscan_peek, :peep) + it_behaves_like :strscan_peek, :peep it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") diff --git a/spec/ruby/library/stringscanner/pointer_spec.rb b/spec/ruby/library/stringscanner/pointer_spec.rb index 8c993c5a71..d9c6d163fe 100644 --- a/spec/ruby/library/stringscanner/pointer_spec.rb +++ b/spec/ruby/library/stringscanner/pointer_spec.rb @@ -3,9 +3,9 @@ require File.expand_path('../shared/pos.rb', __FILE__) require 'strscan' describe "StringScanner#pointer" do - it_behaves_like(:strscan_pos, :pointer) + it_behaves_like :strscan_pos, :pointer end describe "StringScanner#pointer=" do - it_behaves_like(:strscan_pos_set, :pointer=) + it_behaves_like :strscan_pos_set, :pointer= end diff --git a/spec/ruby/library/stringscanner/pos_spec.rb b/spec/ruby/library/stringscanner/pos_spec.rb index 059e6ff846..b23a89e592 100644 --- a/spec/ruby/library/stringscanner/pos_spec.rb +++ b/spec/ruby/library/stringscanner/pos_spec.rb @@ -3,9 +3,9 @@ require File.expand_path('../shared/pos.rb', __FILE__) require 'strscan' describe "StringScanner#pos" do - it_behaves_like(:strscan_pos, :pos) + it_behaves_like :strscan_pos, :pos end describe "StringScanner#pos=" do - it_behaves_like(:strscan_pos_set, :pos=) + it_behaves_like :strscan_pos_set, :pos= end diff --git a/spec/ruby/library/stringscanner/rest_size_spec.rb b/spec/ruby/library/stringscanner/rest_size_spec.rb index ad019f2a6b..97d8546967 100644 --- a/spec/ruby/library/stringscanner/rest_size_spec.rb +++ b/spec/ruby/library/stringscanner/rest_size_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/rest_size.rb', __FILE__) require 'strscan' describe "StringScanner#rest_size" do - it_behaves_like(:strscan_rest_size, :rest_size) + it_behaves_like :strscan_rest_size, :rest_size end diff --git a/spec/ruby/library/stringscanner/restsize_spec.rb b/spec/ruby/library/stringscanner/restsize_spec.rb index 9822d69d84..ffef3c59e9 100644 --- a/spec/ruby/library/stringscanner/restsize_spec.rb +++ b/spec/ruby/library/stringscanner/restsize_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/rest_size.rb', __FILE__) require 'strscan' describe "StringScanner#restsize" do - it_behaves_like(:strscan_rest_size, :restsize) + it_behaves_like :strscan_rest_size, :restsize it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") diff --git a/spec/ruby/library/stringscanner/terminate_spec.rb b/spec/ruby/library/stringscanner/terminate_spec.rb index 01cea3dbdf..3090bd76ba 100644 --- a/spec/ruby/library/stringscanner/terminate_spec.rb +++ b/spec/ruby/library/stringscanner/terminate_spec.rb @@ -3,5 +3,5 @@ require File.expand_path('../shared/terminate.rb', __FILE__) require 'strscan' describe "StringScanner#terminate" do - it_behaves_like(:strscan_terminate, :terminate) + it_behaves_like :strscan_terminate, :terminate end diff --git a/spec/ruby/library/weakref/fixtures/classes.rb b/spec/ruby/library/weakref/fixtures/classes.rb index 9a1d3ce370..560c58b041 100644 --- a/spec/ruby/library/weakref/fixtures/classes.rb +++ b/spec/ruby/library/weakref/fixtures/classes.rb @@ -15,7 +15,8 @@ class WeakRefSpec weak = nil 10_000.times do weaks << make_weakref - 10.times { GC.start } + GC.start + GC.start break if weak = weaks.find { |w| !w.weakref_alive? } end weak |