summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/array/combination_spec.rb2
-rw-r--r--spec/ruby/core/array/fixtures/classes.rb6
-rw-r--r--spec/ruby/core/array/last_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/float.rb52
-rw-r--r--spec/ruby/core/array/product_spec.rb2
-rw-r--r--spec/ruby/core/array/rassoc_spec.rb2
-rw-r--r--spec/ruby/core/array/repeated_combination_spec.rb2
-rw-r--r--spec/ruby/core/array/sum_spec.rb2
-rw-r--r--spec/ruby/core/array/zip_spec.rb2
-rw-r--r--spec/ruby/core/dir/children_spec.rb2
-rw-r--r--spec/ruby/core/dir/entries_spec.rb2
-rw-r--r--spec/ruby/core/dir/shared/glob.rb8
-rw-r--r--spec/ruby/core/encoding/aliases_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/fixtures/classes.rb4
-rw-r--r--spec/ruby/core/enumerable/zip_spec.rb14
-rw-r--r--spec/ruby/core/enumerator/chain/each_spec.rb2
-rw-r--r--spec/ruby/core/exception/signal_exception_spec.rb4
-rw-r--r--spec/ruby/core/file/expand_path_spec.rb2
-rw-r--r--spec/ruby/core/file/new_spec.rb2
-rw-r--r--spec/ruby/core/file/open_spec.rb4
-rw-r--r--spec/ruby/core/file/shared/fnmatch.rb2
-rw-r--r--spec/ruby/core/file/stat/dev_major_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/dev_minor_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/rdev_major_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/rdev_minor_spec.rb8
-rw-r--r--spec/ruby/core/file/sticky_spec.rb2
-rw-r--r--spec/ruby/core/float/comparison_spec.rb2
-rw-r--r--spec/ruby/core/float/round_spec.rb2
-rw-r--r--spec/ruby/core/hash/shift_spec.rb2
-rw-r--r--spec/ruby/core/io/read_spec.rb2
-rw-r--r--spec/ruby/core/io/readlines_spec.rb4
-rw-r--r--spec/ruby/core/io/set_encoding_spec.rb2
-rw-r--r--spec/ruby/core/kernel/autoload_spec.rb4
-rw-r--r--spec/ruby/core/kernel/eval_spec.rb2
-rw-r--r--spec/ruby/core/kernel/throw_spec.rb2
-rw-r--r--spec/ruby/core/math/tan_spec.rb2
-rw-r--r--spec/ruby/core/module/attr_spec.rb2
-rw-r--r--spec/ruby/core/module/autoload_spec.rb2
-rw-r--r--spec/ruby/core/module/comparison_spec.rb2
-rw-r--r--spec/ruby/core/module/const_get_spec.rb2
-rw-r--r--spec/ruby/core/module/refine_spec.rb20
-rw-r--r--spec/ruby/core/numeric/step_spec.rb2
-rw-r--r--spec/ruby/core/process/getrlimit_spec.rb2
-rw-r--r--spec/ruby/core/process/spawn_spec.rb6
-rw-r--r--spec/ruby/core/process/wait_spec.rb2
-rw-r--r--spec/ruby/core/regexp/match_spec.rb2
-rw-r--r--spec/ruby/core/signal/signame_spec.rb2
-rw-r--r--spec/ruby/core/signal/trap_spec.rb2
-rw-r--r--spec/ruby/core/string/chomp_spec.rb8
-rw-r--r--spec/ruby/core/string/chop_spec.rb4
-rw-r--r--spec/ruby/core/string/element_set_spec.rb2
-rw-r--r--spec/ruby/core/string/setbyte_spec.rb2
-rw-r--r--spec/ruby/core/string/shared/codepoints.rb2
-rw-r--r--spec/ruby/core/string/shared/concat.rb2
-rw-r--r--spec/ruby/core/string/shared/equal_value.rb2
-rw-r--r--spec/ruby/core/string/to_r_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/c_spec.rb2
-rw-r--r--spec/ruby/core/string/upto_spec.rb2
-rw-r--r--spec/ruby/core/time/at_spec.rb53
-rw-r--r--spec/ruby/core/time/fixtures/classes.rb69
-rw-r--r--spec/ruby/core/time/getlocal_spec.rb73
-rw-r--r--spec/ruby/core/time/minus_spec.rb20
-rw-r--r--spec/ruby/core/time/new_spec.rb212
-rw-r--r--spec/ruby/core/time/plus_spec.rb25
-rw-r--r--spec/ruby/core/time/succ_spec.rb34
-rw-r--r--spec/ruby/core/tracepoint/enable_spec.rb412
-rw-r--r--spec/ruby/language/block_spec.rb6
-rw-r--r--spec/ruby/language/defined_spec.rb4
-rw-r--r--spec/ruby/language/optional_assignments_spec.rb2
-rw-r--r--spec/ruby/language/private_spec.rb2
-rw-r--r--spec/ruby/language/proc_spec.rb2
-rw-r--r--spec/ruby/language/regexp/escapes_spec.rb2
-rw-r--r--spec/ruby/language/regexp/modifiers_spec.rb2
-rw-r--r--spec/ruby/language/regexp/repetition_spec.rb2
-rw-r--r--spec/ruby/language/regexp_spec.rb2
-rw-r--r--spec/ruby/language/send_spec.rb4
-rw-r--r--spec/ruby/language/until_spec.rb2
-rw-r--r--spec/ruby/language/while_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/divmod_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/sqrt_spec.rb2
-rw-r--r--spec/ruby/library/cgi/rfc1123_date_spec.rb2
-rw-r--r--spec/ruby/library/datetime/to_date_spec.rb2
-rw-r--r--spec/ruby/library/datetime/to_s_spec.rb2
-rw-r--r--spec/ruby/library/datetime/to_time_spec.rb2
-rw-r--r--spec/ruby/library/delegate/delegator/frozen_spec.rb2
-rw-r--r--spec/ruby/library/getoptlong/terminate_spec.rb2
-rw-r--r--spec/ruby/library/logger/logger/new_spec.rb2
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb2
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb2
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb2
-rw-r--r--spec/ruby/library/net/ftp/quit_spec.rb2
-rw-r--r--spec/ruby/library/net/http/http/proxy_class_spec.rb2
-rw-r--r--spec/ruby/library/net/http/httpresponse/read_body_spec.rb2
-rw-r--r--spec/ruby/library/openstruct/frozen_spec.rb2
-rw-r--r--spec/ruby/library/rexml/attribute/initialize_spec.rb2
-rw-r--r--spec/ruby/library/securerandom/hex_spec.rb2
-rw-r--r--spec/ruby/library/set/enumerable/to_set_spec.rb2
-rw-r--r--spec/ruby/library/set/exclusion_spec.rb2
-rw-r--r--spec/ruby/library/set/sortedset/exclusion_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/getsockname_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/getaddress_spec.rb10
-rw-r--r--spec/ruby/library/socket/unixsocket/peeraddr_spec.rb2
-rw-r--r--spec/ruby/library/syslog/log_spec.rb2
-rw-r--r--spec/ruby/library/tempfile/initialize_spec.rb2
-rw-r--r--spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb2
-rw-r--r--spec/ruby/library/uri/plus_spec.rb2
-rw-r--r--spec/ruby/library/weakref/weakref_alive_spec.rb2
-rw-r--r--spec/ruby/library/yaml/parse_file_spec.rb6
-rw-r--r--spec/ruby/library/zlib/gzipreader/read_spec.rb4
111 files changed, 1031 insertions, 231 deletions
diff --git a/spec/ruby/core/array/combination_spec.rb b/spec/ruby/core/array/combination_spec.rb
index 94a8e19341..f16d6f98fc 100644
--- a/spec/ruby/core/array/combination_spec.rb
+++ b/spec/ruby/core/array/combination_spec.rb
@@ -58,7 +58,7 @@ describe "Array#combination" do
@array.combination(-1).size.should == 0
[].combination(-2).size.should == 0
end
- it "returns the binomial coeficient between the array size the number of combinations" do
+ it "returns the binomial coefficient between the array size the number of combinations" do
@array.combination(5).size.should == 0
@array.combination(4).size.should == 1
@array.combination(3).size.should == 4
diff --git a/spec/ruby/core/array/fixtures/classes.rb b/spec/ruby/core/array/fixtures/classes.rb
index 7ca9067328..42071ed0cd 100644
--- a/spec/ruby/core/array/fixtures/classes.rb
+++ b/spec/ruby/core/array/fixtures/classes.rb
@@ -81,7 +81,7 @@ module ArraySpecs
end
end
- class ArrayConvertable
+ class ArrayConvertible
attr_accessor :called
def initialize(*values, &block)
@values = values;
@@ -426,7 +426,7 @@ module ArraySpecs
"assert_no_queries",
"test_change_column_quotes_column_names",
"assert_match",
- "test_keeping_default_and_notnull_constaint_on_change",
+ "test_keeping_default_and_notnull_constraint_on_change",
"methods",
"connection_allow_concurrency_setup",
"connection_allow_concurrency_teardown",
@@ -476,7 +476,7 @@ module ArraySpecs
"test_create_table_without_id",
"test_finds_migrations",
"test_finds_pending_migrations",
- "test_keeping_default_and_notnull_constaint_on_change",
+ "test_keeping_default_and_notnull_constraint_on_change",
"test_migrator",
"test_migrator_db_has_no_schema_migrations_table",
"test_migrator_double_down",
diff --git a/spec/ruby/core/array/last_spec.rb b/spec/ruby/core/array/last_spec.rb
index 871f4a2352..9bf8648776 100644
--- a/spec/ruby/core/array/last_spec.rb
+++ b/spec/ruby/core/array/last_spec.rb
@@ -53,7 +53,7 @@ describe "Array#last" do
array.last.should equal(array)
end
- it "tries to convert the passed argument to an Integer usinig #to_int" do
+ 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)
[1, 2, 3, 4, 5].last(obj).should == [4, 5]
diff --git a/spec/ruby/core/array/pack/shared/float.rb b/spec/ruby/core/array/pack/shared/float.rb
index 082de27acd..6fc3b6b359 100644
--- a/spec/ruby/core/array/pack/shared/float.rb
+++ b/spec/ruby/core/array/pack/shared/float.rb
@@ -41,16 +41,9 @@ describe :array_pack_float_le, shared: true do
[-infinity_value].pack(pack_format).should == "\x00\x00\x80\xff"
end
- platform_is "86" do # x86 / x86_64
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x00\x00\xc0\xff"
- end
- end
-
- platform_is "powerpc64" do
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x00\x00\xc0\x7f"
- end
+ it "encodes NaN" do
+ nans = ["\x00\x00\xc0\xff", "\x00\x00\xc0\x7f"]
+ nans.should include([nan_value].pack(pack_format))
end
it "encodes a positive Float outside the range of a single precision float" do
@@ -103,16 +96,9 @@ describe :array_pack_float_be, shared: true do
[-infinity_value].pack(pack_format).should == "\xff\x80\x00\x00"
end
- platform_is "86" do # x86 / x86_64
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\xff\xc0\x00\x00"
- end
- end
-
- platform_is "powerpc64" do
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x7f\xc0\x00\x00"
- end
+ it "encodes NaN" do
+ nans = ["\xff\xc0\x00\x00", "\x7f\xc0\x00\x00"]
+ nans.should include([nan_value].pack(pack_format))
end
it "encodes a positive Float outside the range of a single precision float" do
@@ -165,16 +151,9 @@ describe :array_pack_double_le, shared: true do
[-infinity_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf0\xff"
end
- platform_is "86" do # x86 / x86_64
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf8\xff"
- end
- end
-
- platform_is "powerpc64" do
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x00\x00\x00\x00\x00\x00\xf8\x7f"
- end
+ it "encodes NaN" do
+ nans = ["\x00\x00\x00\x00\x00\x00\xf8\xff", "\x00\x00\x00\x00\x00\x00\xf8\x7f"]
+ nans.should include([nan_value].pack(pack_format))
end
it "encodes a positive Float outside the range of a single precision float" do
@@ -227,16 +206,9 @@ describe :array_pack_double_be, shared: true do
[-infinity_value].pack(pack_format).should == "\xff\xf0\x00\x00\x00\x00\x00\x00"
end
- platform_is "86" do # x86 / x86_64
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\xff\xf8\x00\x00\x00\x00\x00\x00"
- end
- end
-
- platform_is "powerpc64" do
- it "encodes NaN" do
- [nan_value].pack(pack_format).should == "\x7f\xf8\x00\x00\x00\x00\x00\x00"
- end
+ it "encodes NaN" do
+ nans = ["\xff\xf8\x00\x00\x00\x00\x00\x00", "\x7f\xf8\x00\x00\x00\x00\x00\x00"]
+ nans.should include([nan_value].pack(pack_format))
end
it "encodes a positive Float outside the range of a single precision float" do
diff --git a/spec/ruby/core/array/product_spec.rb b/spec/ruby/core/array/product_spec.rb
index 9207a9b014..7d810b6196 100644
--- a/spec/ruby/core/array/product_spec.rb
+++ b/spec/ruby/core/array/product_spec.rb
@@ -4,7 +4,7 @@ require_relative 'fixtures/classes'
describe "Array#product" do
it "returns converted arguments using :to_ary" do
lambda{ [1].product(2..3) }.should raise_error(TypeError)
- ar = ArraySpecs::ArrayConvertable.new(2,3)
+ ar = ArraySpecs::ArrayConvertible.new(2,3)
[1].product(ar).should == [[1,2],[1,3]]
ar.called.should == :to_ary
end
diff --git a/spec/ruby/core/array/rassoc_spec.rb b/spec/ruby/core/array/rassoc_spec.rb
index decdaae098..62fbd40611 100644
--- a/spec/ruby/core/array/rassoc_spec.rb
+++ b/spec/ruby/core/array/rassoc_spec.rb
@@ -28,7 +28,7 @@ describe "Array#rassoc" do
[[1, :foobar], [2, o], [3, mock('foo')]].rassoc(key).should == [2, o]
end
- it "does not check the last element in each contained but speficically the second" do
+ it "does not check the last element in each contained but specifically the second" do
key = 'foobar'
o = mock('foobar')
def o.==(other); other == 'foobar'; end
diff --git a/spec/ruby/core/array/repeated_combination_spec.rb b/spec/ruby/core/array/repeated_combination_spec.rb
index 373b7bb6e5..b62382024a 100644
--- a/spec/ruby/core/array/repeated_combination_spec.rb
+++ b/spec/ruby/core/array/repeated_combination_spec.rb
@@ -68,7 +68,7 @@ describe "Array#repeated_combination" do
[].repeated_combination(0).size.should == 1
end
- it "returns the binomial coeficient between combination_size and array size + combination_size -1" do
+ it "returns the binomial coefficient between combination_size and array size + combination_size -1" do
@array.repeated_combination(5).size.should == 21
@array.repeated_combination(4).size.should == 15
@array.repeated_combination(3).size.should == 10
diff --git a/spec/ruby/core/array/sum_spec.rb b/spec/ruby/core/array/sum_spec.rb
index 71b8b9dc78..7d19c03480 100644
--- a/spec/ruby/core/array/sum_spec.rb
+++ b/spec/ruby/core/array/sum_spec.rb
@@ -18,7 +18,7 @@ ruby_version_is '2.4' do
[].sum.should == 0
end
- it "adds init value to the sum of elemens" do
+ it "adds init value to the sum of elements" do
[1, 2, 3].sum(10).should == 16
end
diff --git a/spec/ruby/core/array/zip_spec.rb b/spec/ruby/core/array/zip_spec.rb
index f0de864ed4..af4013debe 100644
--- a/spec/ruby/core/array/zip_spec.rb
+++ b/spec/ruby/core/array/zip_spec.rb
@@ -42,7 +42,7 @@ describe "Array#zip" do
[1, 2].zip(10.upto(Float::INFINITY)).should == [[1, 10], [2, 11]]
end
- it "fills nil when the given enumereator is shorter than self" do
+ it "fills nil when the given enumerator is shorter than self" do
obj = Object.new
def obj.each
yield 10
diff --git a/spec/ruby/core/dir/children_spec.rb b/spec/ruby/core/dir/children_spec.rb
index c6329b416f..d28f1b1346 100644
--- a/spec/ruby/core/dir/children_spec.rb
+++ b/spec/ruby/core/dir/children_spec.rb
@@ -65,7 +65,7 @@ ruby_version_is "2.5" do
children.first.encoding.should equal(Encoding::EUC_KR)
end
- it "raises a SystemCallError if called with a nonexistent diretory" do
+ it "raises a SystemCallError if called with a nonexistent directory" do
lambda { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError)
end
end
diff --git a/spec/ruby/core/dir/entries_spec.rb b/spec/ruby/core/dir/entries_spec.rb
index 42f89a1623..488acec81b 100644
--- a/spec/ruby/core/dir/entries_spec.rb
+++ b/spec/ruby/core/dir/entries_spec.rb
@@ -64,7 +64,7 @@ describe "Dir.entries" do
entries.first.encoding.should equal(Encoding::EUC_KR)
end
- it "raises a SystemCallError if called with a nonexistent diretory" do
+ it "raises a SystemCallError if called with a nonexistent directory" do
lambda { Dir.entries DirSpecs.nonexistent }.should raise_error(SystemCallError)
end
end
diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb
index 88ceb82c50..19f457e22a 100644
--- a/spec/ruby/core/dir/shared/glob.rb
+++ b/spec/ruby/core/dir/shared/glob.rb
@@ -273,11 +273,11 @@ describe :dir_glob, shared: true do
subdir_two/nondotfile.ext]
end
- it "ignores matching through directories that doen't exist" do
+ it "ignores matching through directories that doesn't exist" do
Dir.send(@method, "deeply/notthere/blah*/whatever").should == []
end
- it "ignores matching only directories under an nonexistant path" do
+ it "ignores matching only directories under an nonexistent path" do
Dir.send(@method, "deeply/notthere/blah/").should == []
end
@@ -312,7 +312,7 @@ describe :dir_glob, shared: true do
Dir.send(@method, "*", base: path).sort.should == %w( d y )
end
- it "accepts both relative and absolute pathes" do
+ it "accepts both relative and absolute paths" do
require 'pathname'
path_abs = File.join(@mock_dir, "a/b/c")
@@ -339,7 +339,7 @@ describe :dir_glob, shared: true do
Dir.send(@method, "*", base: path).should == []
end
- it "raises TypeError whene cannot convert value to string" do
+ it "raises TypeError when cannot convert value to string" do
-> {
Dir.send(@method, "*", base: [])
}.should raise_error(TypeError)
diff --git a/spec/ruby/core/encoding/aliases_spec.rb b/spec/ruby/core/encoding/aliases_spec.rb
index 88c7a1f2ef..22e4510993 100644
--- a/spec/ruby/core/encoding/aliases_spec.rb
+++ b/spec/ruby/core/encoding/aliases_spec.rb
@@ -32,7 +32,7 @@ with_feature :encoding do
Encoding.aliases['external'].should == Encoding.default_external.name
end
- it "has a 'locale' key and its value equals to the name of the encoding finded by the locale charmap" do
+ it "has a 'locale' key and its value equals the name of the encoding found by the locale charmap" do
Encoding.aliases['locale'].should == Encoding.find(Encoding.locale_charmap).name
end
diff --git a/spec/ruby/core/enumerable/fixtures/classes.rb b/spec/ruby/core/enumerable/fixtures/classes.rb
index e50bf34779..5051196742 100644
--- a/spec/ruby/core/enumerable/fixtures/classes.rb
+++ b/spec/ruby/core/enumerable/fixtures/classes.rb
@@ -118,7 +118,7 @@ module EnumerableSpecs
end
end
- class ArrayConvertable
+ class ArrayConvertible
attr_accessor :called
def initialize(*values)
@values = values
@@ -135,7 +135,7 @@ module EnumerableSpecs
end
end
- class EnumConvertable
+ class EnumConvertible
attr_accessor :called
attr_accessor :sym
def initialize(delegate)
diff --git a/spec/ruby/core/enumerable/zip_spec.rb b/spec/ruby/core/enumerable/zip_spec.rb
index 1212911697..9ec15aa030 100644
--- a/spec/ruby/core/enumerable/zip_spec.rb
+++ b/spec/ruby/core/enumerable/zip_spec.rb
@@ -21,16 +21,16 @@ describe "Enumerable#zip" do
end
it "converts arguments to arrays using #to_ary" do
- convertable = EnumerableSpecs::ArrayConvertable.new(4,5,6)
- EnumerableSpecs::Numerous.new(1,2,3).zip(convertable).should == [[1,4],[2,5],[3,6]]
- convertable.called.should == :to_ary
+ convertible = EnumerableSpecs::ArrayConvertible.new(4,5,6)
+ EnumerableSpecs::Numerous.new(1,2,3).zip(convertible).should == [[1,4],[2,5],[3,6]]
+ convertible.called.should == :to_ary
end
it "converts arguments to enums using #to_enum" do
- convertable = EnumerableSpecs::EnumConvertable.new(4..6)
- EnumerableSpecs::Numerous.new(1,2,3).zip(convertable).should == [[1,4],[2,5],[3,6]]
- convertable.called.should == :to_enum
- convertable.sym.should == :each
+ convertible = EnumerableSpecs::EnumConvertible.new(4..6)
+ EnumerableSpecs::Numerous.new(1,2,3).zip(convertible).should == [[1,4],[2,5],[3,6]]
+ convertible.called.should == :to_enum
+ convertible.sym.should == :each
end
it "gathers whole arrays as elements when each yields multiple" do
diff --git a/spec/ruby/core/enumerator/chain/each_spec.rb b/spec/ruby/core/enumerator/chain/each_spec.rb
index dab2c1cf1d..ab4d355f22 100644
--- a/spec/ruby/core/enumerator/chain/each_spec.rb
+++ b/spec/ruby/core/enumerator/chain/each_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../enumerable/fixtures/classes'
ruby_version_is "2.6" do
describe "Enumerator::Chain#each" do
- it "calls each on its consistuents as needed" do
+ it "calls each on its constituents as needed" do
a = EnumerableSpecs::EachCounter.new(:a, :b)
b = EnumerableSpecs::EachCounter.new(:c, :d)
diff --git a/spec/ruby/core/exception/signal_exception_spec.rb b/spec/ruby/core/exception/signal_exception_spec.rb
index c0632841d6..8e2f273a67 100644
--- a/spec/ruby/core/exception/signal_exception_spec.rb
+++ b/spec/ruby/core/exception/signal_exception_spec.rb
@@ -27,7 +27,7 @@ describe "SignalException.new" do
end
it "raises an exception with an invalid signal name" do
- lambda { SignalException.new("NONEXISTANT") }.should raise_error(ArgumentError)
+ lambda { SignalException.new("NONEXISTENT") }.should raise_error(ArgumentError)
end
it "takes a signal symbol without SIG prefix as the first argument" do
@@ -45,7 +45,7 @@ describe "SignalException.new" do
end
it "raises an exception with an invalid signal name" do
- lambda { SignalException.new(:NONEXISTANT) }.should raise_error(ArgumentError)
+ lambda { SignalException.new(:NONEXISTENT) }.should raise_error(ArgumentError)
end
it "takes an optional message argument with a signal number" do
diff --git a/spec/ruby/core/file/expand_path_spec.rb b/spec/ruby/core/file/expand_path_spec.rb
index 9ecd730a7b..6e24e62075 100644
--- a/spec/ruby/core/file/expand_path_spec.rb
+++ b/spec/ruby/core/file/expand_path_spec.rb
@@ -71,7 +71,7 @@ describe "File.expand_path" do
File.expand_path("../bin", "x/../tmp").should == File.join(@base, 'bin')
end
- it "expand_path for commoms unix path give a full path" do
+ it "expand_path for common unix path gives a full path" do
File.expand_path('/tmp/').should =='/tmp'
File.expand_path('/tmp/../../../tmp').should == '/tmp'
File.expand_path('').should == Dir.pwd
diff --git a/spec/ruby/core/file/new_spec.rb b/spec/ruby/core/file/new_spec.rb
index 815ecd9d36..3bb2712ada 100644
--- a/spec/ruby/core/file/new_spec.rb
+++ b/spec/ruby/core/file/new_spec.rb
@@ -38,7 +38,7 @@ describe "File.new" do
end
it "creates the file and returns writable descriptor when called with 'w' mode and r-o permissions" do
- # it should be possible to write to such a file via returned descriptior,
+ # it should be possible to write to such a file via returned descriptor,
# even though the file permissions are r-r-r.
rm_r @file
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb
index c37e7316ba..931ff2d239 100644
--- a/spec/ruby/core/file/open_spec.rb
+++ b/spec/ruby/core/file/open_spec.rb
@@ -128,7 +128,7 @@ describe "File.open" do
end
it "creates the file and returns writable descriptor when called with 'w' mode and r-o permissions" do
- # it should be possible to write to such a file via returned descriptior,
+ # it should be possible to write to such a file via returned descriptor,
# even though the file permissions are r-r-r.
File.open(@file, "w", 0444) { |f| f.write("test") }
@@ -236,7 +236,7 @@ describe "File.open" do
File.exist?(@file).should == true
end
- # Check the grants associated to the differents open modes combinations.
+ # Check the grants associated to the different open modes combinations.
it "raises an ArgumentError exception when call with an unknown mode" do
lambda { File.open(@file, "q") }.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/core/file/shared/fnmatch.rb b/spec/ruby/core/file/shared/fnmatch.rb
index 9b423ae47e..49a870e95a 100644
--- a/spec/ruby/core/file/shared/fnmatch.rb
+++ b/spec/ruby/core/file/shared/fnmatch.rb
@@ -87,7 +87,7 @@ describe :file_fnmatch, shared: true do
File.send(@method, '[a-z]', 'D', File::FNM_CASEFOLD).should == true
end
- it "does not match characters outside of the range of the bracket expresion" do
+ it "does not match characters outside of the range of the bracket expression" do
File.send(@method, 'ca[x-z]', 'cat').should == false
File.send(@method, '/ca[s][s-t]/rul[a-b]/[z]he/[x-Z]orld', '/cats/rule/the/World').should == false
end
diff --git a/spec/ruby/core/file/stat/dev_major_spec.rb b/spec/ruby/core/file/stat/dev_major_spec.rb
index 4966d609e2..845c883a42 100644
--- a/spec/ruby/core/file/stat/dev_major_spec.rb
+++ b/spec/ruby/core/file/stat/dev_major_spec.rb
@@ -9,9 +9,11 @@ describe "File::Stat#dev_major" do
rm_r @name
end
- platform_is_not :windows do
- it "returns the major part of File::Stat#dev" do
- File.stat(@name).dev_major.should be_kind_of(Integer)
+ ruby_version_is "2.4" do
+ platform_is_not :windows do
+ it "returns the major part of File::Stat#dev" do
+ File.stat(@name).dev_major.should be_kind_of(Integer)
+ end
end
end
diff --git a/spec/ruby/core/file/stat/dev_minor_spec.rb b/spec/ruby/core/file/stat/dev_minor_spec.rb
index ea79c12b99..ddfb6a7b6a 100644
--- a/spec/ruby/core/file/stat/dev_minor_spec.rb
+++ b/spec/ruby/core/file/stat/dev_minor_spec.rb
@@ -9,9 +9,11 @@ describe "File::Stat#dev_minor" do
rm_r @name
end
- platform_is_not :windows do
- it "returns the minor part of File::Stat#dev" do
- File.stat(@name).dev_minor.should be_kind_of(Integer)
+ ruby_version_is "2.4" do
+ platform_is_not :windows do
+ it "returns the minor part of File::Stat#dev" do
+ File.stat(@name).dev_minor.should be_kind_of(Integer)
+ end
end
end
diff --git a/spec/ruby/core/file/stat/rdev_major_spec.rb b/spec/ruby/core/file/stat/rdev_major_spec.rb
index f8a8d1b107..3d7f6ef759 100644
--- a/spec/ruby/core/file/stat/rdev_major_spec.rb
+++ b/spec/ruby/core/file/stat/rdev_major_spec.rb
@@ -17,9 +17,11 @@ describe "File::Stat#rdev_major" do
end
end
- platform_is_not :windows do
- it "returns the major part of File::Stat#rdev" do
- File.stat(@name).rdev_major.should be_kind_of(Integer)
+ ruby_version_is "2.4" do
+ platform_is_not :windows do
+ it "returns the major part of File::Stat#rdev" do
+ File.stat(@name).rdev_major.should be_kind_of(Integer)
+ end
end
end
diff --git a/spec/ruby/core/file/stat/rdev_minor_spec.rb b/spec/ruby/core/file/stat/rdev_minor_spec.rb
index dc30c1f56c..e25c61ca86 100644
--- a/spec/ruby/core/file/stat/rdev_minor_spec.rb
+++ b/spec/ruby/core/file/stat/rdev_minor_spec.rb
@@ -17,9 +17,11 @@ describe "File::Stat#rdev_minor" do
end
end
- platform_is_not :windows do
- it "returns the minor part of File::Stat#rdev" do
- File.stat(@name).rdev_minor.should be_kind_of(Integer)
+ ruby_version_is "2.4" do
+ platform_is_not :windows do
+ it "returns the minor part of File::Stat#rdev" do
+ File.stat(@name).rdev_minor.should be_kind_of(Integer)
+ end
end
end
diff --git a/spec/ruby/core/file/sticky_spec.rb b/spec/ruby/core/file/sticky_spec.rb
index 7805c39f79..5f7b2d93eb 100644
--- a/spec/ruby/core/file/sticky_spec.rb
+++ b/spec/ruby/core/file/sticky_spec.rb
@@ -35,7 +35,7 @@ describe "File.sticky?" do
end
platform_is :bsd do
- # FreeBSD and NetBSD can't set stiky bit to a normal file
+ # FreeBSD and NetBSD can't set sticky bit to a normal file
it "cannot set sticky bit to a normal file" do
filename = tmp("i_exist")
touch(filename)
diff --git a/spec/ruby/core/float/comparison_spec.rb b/spec/ruby/core/float/comparison_spec.rb
index a1ee423c24..4205d95c83 100644
--- a/spec/ruby/core/float/comparison_spec.rb
+++ b/spec/ruby/core/float/comparison_spec.rb
@@ -22,7 +22,7 @@ describe "Float#<=>" do
(infinity_value <=> Float::MAX.to_i*2).should == 1
end
- it "returns -1 when self is negative and other is Infinty" do
+ it "returns -1 when self is negative and other is Infinity" do
(-Float::MAX.to_i*2 <=> infinity_value).should == -1
end
diff --git a/spec/ruby/core/float/round_spec.rb b/spec/ruby/core/float/round_spec.rb
index df113f97b1..a21173e139 100644
--- a/spec/ruby/core/float/round_spec.rb
+++ b/spec/ruby/core/float/round_spec.rb
@@ -30,7 +30,7 @@ describe "Float#round" do
12.345678.round(3.999).should == 12.346
end
- it "returns zero when passed a negative argument with magitude greater the magitude of the whole number portion of the Float" do
+ it "returns zero when passed a negative argument with magnitude greater than magnitude of the whole number portion of the Float" do
0.8346268.round(-1).should eql(0)
end
diff --git a/spec/ruby/core/hash/shift_spec.rb b/spec/ruby/core/hash/shift_spec.rb
index 8cf3f4025a..47c9ac1821 100644
--- a/spec/ruby/core/hash/shift_spec.rb
+++ b/spec/ruby/core/hash/shift_spec.rb
@@ -63,7 +63,7 @@ describe "Hash#shift" do
end
it "works when the hash is at capacity" do
- # We try a wide range of sizes in hopes that this will cover all implementationss base Hash size.
+ # We try a wide range of sizes in hopes that this will cover all implementations' base Hash size.
results = []
1.upto(100) do |n|
h = {}
diff --git a/spec/ruby/core/io/read_spec.rb b/spec/ruby/core/io/read_spec.rb
index 3bb581f430..6f6713d957 100644
--- a/spec/ruby/core/io/read_spec.rb
+++ b/spec/ruby/core/io/read_spec.rb
@@ -497,7 +497,7 @@ with_feature :encoding do
buf.encoding.should equal(Encoding::ISO_8859_1)
end
- it "trucates the buffer but does not change the buffer's encoding when no data remains" do
+ it "truncates the buffer but does not change the buffer's encoding when no data remains" do
buf = "abc".force_encoding Encoding::ISO_8859_1
@io.read
diff --git a/spec/ruby/core/io/readlines_spec.rb b/spec/ruby/core/io/readlines_spec.rb
index 533c9c3132..c1ea706b26 100644
--- a/spec/ruby/core/io/readlines_spec.rb
+++ b/spec/ruby/core/io/readlines_spec.rb
@@ -6,13 +6,13 @@ require_relative 'shared/readlines'
describe "IO#readlines" do
before :each do
@io = IOSpecs.io_fixture "lines.txt"
- @orig_exteenc = Encoding.default_external
+ @orig_extenc = Encoding.default_external
Encoding.default_external = Encoding::UTF_8
end
after :each do
@io.close unless @io.closed?
- Encoding.default_external = @orig_exteenc
+ Encoding.default_external = @orig_extenc
end
it "raises an IOError if the stream is closed" do
diff --git a/spec/ruby/core/io/set_encoding_spec.rb b/spec/ruby/core/io/set_encoding_spec.rb
index b749331ee0..9875d64ab8 100644
--- a/spec/ruby/core/io/set_encoding_spec.rb
+++ b/spec/ruby/core/io/set_encoding_spec.rb
@@ -156,7 +156,7 @@ with_feature :encoding do
@io.internal_encoding.should be_nil
end
- it "ignores the internal encoding if the same as external when passed encoding names separanted by ':'" do
+ it "ignores the internal encoding if the same as external when passed encoding names separated by ':'" do
@io.set_encoding("utf-8:utf-8")
@io.external_encoding.should == Encoding::UTF_8
@io.internal_encoding.should be_nil
diff --git a/spec/ruby/core/kernel/autoload_spec.rb b/spec/ruby/core/kernel/autoload_spec.rb
index 5fa8fa92b3..3e7a63ede0 100644
--- a/spec/ruby/core/kernel/autoload_spec.rb
+++ b/spec/ruby/core/kernel/autoload_spec.rb
@@ -72,7 +72,7 @@ describe "Kernel#autoload" do
KernelSpecs::AutoloadMethod.autoload?(:AutoloadFromIncludedModule).should == @path
end
- it "the autoload is reacheable from the class too" do
+ it "the autoload is reachable from the class too" do
KernelSpecs::AutoloadMethodIncluder.autoload?(:AutoloadFromIncludedModule).should == @path
end
@@ -138,7 +138,7 @@ describe "Kernel.autoload" do
KernelSpecs::AutoloadMethod2.autoload?(:AutoloadFromIncludedModule2).should == @path
end
- it "the autoload is reacheable from the class too" do
+ it "the autoload is reachable from the class too" do
KernelSpecs::AutoloadMethodIncluder2.autoload?(:AutoloadFromIncludedModule2).should == @path
end
diff --git a/spec/ruby/core/kernel/eval_spec.rb b/spec/ruby/core/kernel/eval_spec.rb
index 46158628a3..696c55a3ba 100644
--- a/spec/ruby/core/kernel/eval_spec.rb
+++ b/spec/ruby/core/kernel/eval_spec.rb
@@ -24,7 +24,7 @@ describe "Kernel#eval" do
EvalSpecs::A::B.name.should == "EvalSpecs::A::B"
end
- it "evaluates such that consts are scoped to the class of the eval" do
+ it "evaluates such that constants are scoped to the class of the eval" do
EvalSpecs::A::C.name.should == "EvalSpecs::A::C"
end
diff --git a/spec/ruby/core/kernel/throw_spec.rb b/spec/ruby/core/kernel/throw_spec.rb
index 8f8486accc..1e56376529 100644
--- a/spec/ruby/core/kernel/throw_spec.rb
+++ b/spec/ruby/core/kernel/throw_spec.rb
@@ -10,7 +10,7 @@ describe "Kernel.throw" do
end.should be_nil
end
- it "transfers control to the innermost catch block waiting for the same sympol" do
+ it "transfers control to the innermost catch block waiting for the same symbol" do
one = two = three = 0
catch :duplicate do
catch :duplicate do
diff --git a/spec/ruby/core/math/tan_spec.rb b/spec/ruby/core/math/tan_spec.rb
index bf5c80f77c..031fe75085 100644
--- a/spec/ruby/core/math/tan_spec.rb
+++ b/spec/ruby/core/math/tan_spec.rb
@@ -13,7 +13,7 @@ describe "Math.tan" do
Math.tan(-9.65).should be_close(-0.229109052606441, TOLERANCE)
end
- it "returns NaN if called with +-Infinitty" do
+ it "returns NaN if called with +-Infinity" do
Math.tan(infinity_value).nan?.should == true
Math.tan(-infinity_value).nan?.should == true
end
diff --git a/spec/ruby/core/module/attr_spec.rb b/spec/ruby/core/module/attr_spec.rb
index b114b06b6e..16680730d5 100644
--- a/spec/ruby/core/module/attr_spec.rb
+++ b/spec/ruby/core/module/attr_spec.rb
@@ -54,7 +54,7 @@ describe "Module#attr" do
o.attr3 = "test3 updated"
end
- it "creates a getter and setter for the given attribute name if called with and without writeable is true" do
+ it "creates a getter and setter for the given attribute name if called with and without writable is true" do
c = Class.new do
attr :attr, true
attr :attr
diff --git a/spec/ruby/core/module/autoload_spec.rb b/spec/ruby/core/module/autoload_spec.rb
index b028dbc56c..05e9a61675 100644
--- a/spec/ruby/core/module/autoload_spec.rb
+++ b/spec/ruby/core/module/autoload_spec.rb
@@ -636,7 +636,7 @@ describe "Module#autoload" do
end.should raise_error(TypeError)
end
- it "raises a TypeError if not passed a String or object respodning to #to_path for the filename" do
+ it "raises a TypeError if not passed a String or object responding to #to_path for the filename" do
name = mock("autoload_name.rb")
lambda { ModuleSpecs::Autoload.autoload :Str, name }.should raise_error(TypeError)
diff --git a/spec/ruby/core/module/comparison_spec.rb b/spec/ruby/core/module/comparison_spec.rb
index 069bbd7a97..86ee5db22a 100644
--- a/spec/ruby/core/module/comparison_spec.rb
+++ b/spec/ruby/core/module/comparison_spec.rb
@@ -16,7 +16,7 @@ describe "Module#<=>" do
(ModuleSpecs::Super <=> ModuleSpecs::Super).should == 0
end
- it "returns +1 if self is a superclas of or included by the given module" do
+ it "returns +1 if self is a superclass of or included by the given module" do
(ModuleSpecs::Parent <=> ModuleSpecs::Child).should == +1
(ModuleSpecs::Basic <=> ModuleSpecs::Child).should == +1
(ModuleSpecs::Super <=> ModuleSpecs::Child).should == +1
diff --git a/spec/ruby/core/module/const_get_spec.rb b/spec/ruby/core/module/const_get_spec.rb
index 461b303d6d..d125c35762 100644
--- a/spec/ruby/core/module/const_get_spec.rb
+++ b/spec/ruby/core/module/const_get_spec.rb
@@ -66,7 +66,7 @@ describe "Module#const_get" do
end.should raise_error(NameError)
end
- it "raises a NameError if the constant is defined in the receiver's supperclass and the inherit flag is false" do
+ it "raises a NameError if the constant is defined in the receiver's superclass and the inherit flag is false" do
lambda do
ConstantSpecs::ContainerA::ChildA.const_get(:CS_CONST4, false)
end.should raise_error(NameError)
diff --git a/spec/ruby/core/module/refine_spec.rb b/spec/ruby/core/module/refine_spec.rb
index 42b2b64331..4f34062343 100644
--- a/spec/ruby/core/module/refine_spec.rb
+++ b/spec/ruby/core/module/refine_spec.rb
@@ -84,20 +84,18 @@ describe "Module#refine" do
end
end
- quarantine! do # https://bugs.ruby-lang.org/issues/14070
- ruby_version_is "2.4" do
- it "accepts a module as argument" do
- inner_self = nil
- Module.new do
- refine(Enumerable) do
- def blah
- end
- inner_self = self
+ ruby_version_is "2.4" do
+ it "accepts a module as argument" do
+ inner_self = nil
+ Module.new do
+ refine(Enumerable) do
+ def blah
end
+ inner_self = self
end
-
- inner_self.public_instance_methods.should include(:blah)
end
+
+ inner_self.public_instance_methods.should include(:blah)
end
end
diff --git a/spec/ruby/core/numeric/step_spec.rb b/spec/ruby/core/numeric/step_spec.rb
index 96439927a4..a0a4c7c9f8 100644
--- a/spec/ruby/core/numeric/step_spec.rb
+++ b/spec/ruby/core/numeric/step_spec.rb
@@ -114,7 +114,7 @@ describe "Numeric#step" do
1.step(to: Float::INFINITY, by: 42).size.should == infinity_value
end
- it "should return infinity_value when decending towards a limit of -Float::INFINITY" do
+ it "should return infinity_value when descending towards a limit of -Float::INFINITY" do
1.step(to: -Float::INFINITY, by: -42).size.should == infinity_value
end
diff --git a/spec/ruby/core/process/getrlimit_spec.rb b/spec/ruby/core/process/getrlimit_spec.rb
index 2ab825532b..0258bb3d80 100644
--- a/spec/ruby/core/process/getrlimit_spec.rb
+++ b/spec/ruby/core/process/getrlimit_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
platform_is :aix do
# In AIX, if getrlimit(2) is called multiple times with RLIMIT_DATA,
- # the first call and the subequent calls return slightly different
+ # the first call and the subsequent calls return slightly different
# values of rlim_cur, even if the process does nothing between
# the calls. This behavior causes some of the tests in this spec
# to fail, so call Process.getrlimit(:DATA) once and discard the result.
diff --git a/spec/ruby/core/process/spawn_spec.rb b/spec/ruby/core/process/spawn_spec.rb
index bb55fe299b..aa7a7dc3aa 100644
--- a/spec/ruby/core/process/spawn_spec.rb
+++ b/spec/ruby/core/process/spawn_spec.rb
@@ -451,7 +451,7 @@ describe "Process.spawn" do
# redirection
- it "redirects STDOUT to the given file descriptior if out: Fixnum" do
+ it "redirects STDOUT to the given file descriptor if out: Fixnum" do
File.open(@name, 'w') do |file|
lambda do
Process.wait Process.spawn("echo glark", out: file.fileno)
@@ -477,7 +477,7 @@ describe "Process.spawn" do
File.read(@name).should == "glark\n"
end
- it "redirects STDERR to the given file descriptior if err: Fixnum" do
+ it "redirects STDERR to the given file descriptor if err: Fixnum" do
File.open(@name, 'w') do |file|
lambda do
Process.wait Process.spawn("echo glark>&2", err: file.fileno)
@@ -506,7 +506,7 @@ describe "Process.spawn" do
end
end
- it "redirects both STDERR and STDOUT to the given file descriptior" do
+ it "redirects both STDERR and STDOUT to the given file descriptor" do
File.open(@name, 'w') do |file|
lambda do
Process.wait Process.spawn(ruby_cmd("print(:glark); STDOUT.flush; STDERR.print(:bang)"),
diff --git a/spec/ruby/core/process/wait_spec.rb b/spec/ruby/core/process/wait_spec.rb
index 5130bb4391..099fcdc518 100644
--- a/spec/ruby/core/process/wait_spec.rb
+++ b/spec/ruby/core/process/wait_spec.rb
@@ -21,7 +21,7 @@ describe "Process.wait" do
end
platform_is_not :windows do
- it "returns its childs pid" do
+ it "returns its child pid" do
pid = Process.spawn(ruby_cmd('exit'))
Process.wait.should == pid
end
diff --git a/spec/ruby/core/regexp/match_spec.rb b/spec/ruby/core/regexp/match_spec.rb
index e3247a088d..edac0d1d42 100644
--- a/spec/ruby/core/regexp/match_spec.rb
+++ b/spec/ruby/core/regexp/match_spec.rb
@@ -100,7 +100,7 @@ describe "Regexp#match" do
$~.should be_nil
end
- it "raises TypeError when the given argument cannot be coarce to String" do
+ it "raises TypeError when the given argument cannot be coerced to String" do
f = 1
lambda { /foo/.match(f)[0] }.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/signal/signame_spec.rb b/spec/ruby/core/signal/signame_spec.rb
index 71b69b301a..41b43d3482 100644
--- a/spec/ruby/core/signal/signame_spec.rb
+++ b/spec/ruby/core/signal/signame_spec.rb
@@ -14,7 +14,7 @@ describe "Signal.signame" do
end
platform_is_not :windows do
- it "the original should take precendence over alias when looked up by number" do
+ it "the original should take precedence over alias when looked up by number" do
Signal.signame(Signal.list["ABRT"]).should == "ABRT"
Signal.signame(Signal.list["CHLD"]).should == "CHLD"
end
diff --git a/spec/ruby/core/signal/trap_spec.rb b/spec/ruby/core/signal/trap_spec.rb
index c11c900add..a3298c71e1 100644
--- a/spec/ruby/core/signal/trap_spec.rb
+++ b/spec/ruby/core/signal/trap_spec.rb
@@ -78,7 +78,7 @@ platform_is_not :windows do
Signal.trap("SIGHUP", @saved_trap).should equal(@proc)
end
- it "acceps short names as Strings" do
+ it "accepts short names as Strings" do
Signal.trap "HUP", @proc
Signal.trap("HUP", @saved_trap).should equal(@proc)
end
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb
index 3c20141ee7..d6ad710382 100644
--- a/spec/ruby/core/string/chomp_spec.rb
+++ b/spec/ruby/core/string/chomp_spec.rb
@@ -30,7 +30,7 @@ describe "String#chomp" do
"abc\r\r".chomp.should == "abc\r"
end
- it "removes one trailing carrige return, newline pair" do
+ it "removes one trailing carriage return, newline pair" do
"abc\r\n\r\n".chomp.should == "abc\r\n"
end
@@ -111,7 +111,7 @@ describe "String#chomp" do
"abc\r\r".chomp("\n").should == "abc\r"
end
- it "removes one trailing carrige return, newline pair" do
+ it "removes one trailing carriage return, newline pair" do
"abc\r\n\r\n".chomp("\n").should == "abc\r\n"
end
@@ -193,7 +193,7 @@ describe "String#chomp!" do
"abc\r\r".chomp!.should == "abc\r"
end
- it "removes one trailing carrige return, newline pair" do
+ it "removes one trailing carriage return, newline pair" do
"abc\r\n\r\n".chomp!.should == "abc\r\n"
end
@@ -265,7 +265,7 @@ describe "String#chomp!" do
"abc\r\r".chomp!("\n").should == "abc\r"
end
- it "removes one trailing carrige return, newline pair" do
+ it "removes one trailing carriage return, newline pair" do
"abc\r\n\r\n".chomp!("\n").should == "abc\r\n"
end
diff --git a/spec/ruby/core/string/chop_spec.rb b/spec/ruby/core/string/chop_spec.rb
index 57c037322d..033a11a95b 100644
--- a/spec/ruby/core/string/chop_spec.rb
+++ b/spec/ruby/core/string/chop_spec.rb
@@ -19,7 +19,7 @@ describe "String#chop" do
"abc\r\n".chop.should == "abc"
end
- it "removes the carrige return, newline if they are the only characters" do
+ it "removes the carriage return, newline if they are the only characters" do
"\r\n".chop.should == ""
end
@@ -83,7 +83,7 @@ describe "String#chop!" do
"abc\r\n".chop!.should == "abc"
end
- it "removes the carrige return, newline if they are the only characters" do
+ it "removes the carriage return, newline if they are the only characters" do
"\r\n".chop!.should == ""
end
diff --git a/spec/ruby/core/string/element_set_spec.rb b/spec/ruby/core/string/element_set_spec.rb
index 80ec5755c6..340bd2b9ca 100644
--- a/spec/ruby/core/string/element_set_spec.rb
+++ b/spec/ruby/core/string/element_set_spec.rb
@@ -36,7 +36,7 @@ describe "String#[]= with Fixnum index" do
lambda { ""[-1] = "bam" }.should raise_error(IndexError)
end
- # Behaviour verfieid correct by matz in
+ # Behaviour is verified by matz in
# http://redmine.ruby-lang.org/issues/show/1750
it "allows assignment to the zero'th element of an empty String" do
str = ""
diff --git a/spec/ruby/core/string/setbyte_spec.rb b/spec/ruby/core/string/setbyte_spec.rb
index f998e61622..3f2e03f8a8 100644
--- a/spec/ruby/core/string/setbyte_spec.rb
+++ b/spec/ruby/core/string/setbyte_spec.rb
@@ -54,7 +54,7 @@ describe "String#setbyte" do
lambda { "?".setbyte(1, 97) }.should raise_error(IndexError)
end
- it "raises an IndexError if the nexgative index is greater magnitude than the String bytesize" do
+ it "raises an IndexError if the negative index is greater magnitude than the String bytesize" do
lambda { "???".setbyte(-5, 97) }.should raise_error(IndexError)
end
diff --git a/spec/ruby/core/string/shared/codepoints.rb b/spec/ruby/core/string/shared/codepoints.rb
index 68f82b4468..589d2ee1d0 100644
--- a/spec/ruby/core/string/shared/codepoints.rb
+++ b/spec/ruby/core/string/shared/codepoints.rb
@@ -48,7 +48,7 @@ describe :string_codepoints, shared: true do
s.should == s2
end
- it "is synonymous with #bytes for Strings which are single-byte optimisable" do
+ it "is synonymous with #bytes for Strings which are single-byte optimizable" do
s = "(){}".encode('ascii')
s.ascii_only?.should be_true
s.send(@method).to_a.should == s.bytes.to_a
diff --git a/spec/ruby/core/string/shared/concat.rb b/spec/ruby/core/string/shared/concat.rb
index d7b9cdfec3..bc38ba9a8b 100644
--- a/spec/ruby/core/string/shared/concat.rb
+++ b/spec/ruby/core/string/shared/concat.rb
@@ -50,7 +50,7 @@ describe :string_concat, shared: true do
end
describe "with Integer" do
- it "concatencates the argument interpreted as a codepoint" do
+ it "concatenates the argument interpreted as a codepoint" do
b = "".send(@method, 33)
b.should == "!"
diff --git a/spec/ruby/core/string/shared/equal_value.rb b/spec/ruby/core/string/shared/equal_value.rb
index d797cb1483..fccafb5821 100644
--- a/spec/ruby/core/string/shared/equal_value.rb
+++ b/spec/ruby/core/string/shared/equal_value.rb
@@ -17,7 +17,7 @@ describe :string_equal_value, shared: true do
# not call it.
obj.stub!(:to_str)
- # Don't use @method for :== in `obj.should_recerive(:==)`
+ # Don't use @method for :== in `obj.should_receive(:==)`
obj.should_receive(:==).and_return(true)
'hello'.send(@method, obj).should be_true
diff --git a/spec/ruby/core/string/to_r_spec.rb b/spec/ruby/core/string/to_r_spec.rb
index 9f174a2f55..7e1d635d3b 100644
--- a/spec/ruby/core/string/to_r_spec.rb
+++ b/spec/ruby/core/string/to_r_spec.rb
@@ -29,7 +29,7 @@ describe "String#to_r" do
"a1765, ".to_r.should_not == Rational(1765, 1)
end
- it "treats leading hypens as minus signs" do
+ it "treats leading hyphen as minus signs" do
"-20".to_r.should == Rational(-20, 1)
end
diff --git a/spec/ruby/core/string/unpack/c_spec.rb b/spec/ruby/core/string/unpack/c_spec.rb
index 82c0f8616d..bdcbd87663 100644
--- a/spec/ruby/core/string/unpack/c_spec.rb
+++ b/spec/ruby/core/string/unpack/c_spec.rb
@@ -20,7 +20,7 @@ describe :string_unpack_8bit, shared: true do
"abc".unpack(unpack_format('*')).should == [97, 98, 99]
end
- it "decodes the remaining bytes when passed the '*' modifer after another directive" do
+ it "decodes the remaining bytes when passed the '*' modifier after another directive" do
"abc".unpack(unpack_format()+unpack_format('*')).should == [97, 98, 99]
end
diff --git a/spec/ruby/core/string/upto_spec.rb b/spec/ruby/core/string/upto_spec.rb
index d2f1121360..3748a6fdeb 100644
--- a/spec/ruby/core/string/upto_spec.rb
+++ b/spec/ruby/core/string/upto_spec.rb
@@ -8,7 +8,7 @@ describe "String#upto" do
a.should == ["*+", "*,", "*-", "*.", "*/", "*0", "*1", "*2", "*3"]
end
- it "calls the block once even when start eqals stop" do
+ it "calls the block once even when start equals stop" do
a = []
"abc".upto("abc") { |s| a << s }
a.should == ["abc"]
diff --git a/spec/ruby/core/time/at_spec.rb b/spec/ruby/core/time/at_spec.rb
index 7c66104156..1493012676 100644
--- a/spec/ruby/core/time/at_spec.rb
+++ b/spec/ruby/core/time/at_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Time.at" do
describe "passed Numeric" do
@@ -198,4 +199,56 @@ describe "Time.at" do
end
end
end
+
+ ruby_version_is "2.6" do
+ describe ":in keyword argument" do
+ before do
+ @epoch_time = Time.now.to_i
+ end
+
+ it "could be UTC offset as a String in '+HH:MM or '-HH:MM' format" do
+ time = Time.at(@epoch_time, in: "+05:00")
+
+ time.utc_offset.should == 5*60*60
+ time.zone.should == nil
+ time.to_i.should == @epoch_time
+
+ time = Time.at(@epoch_time, in: "-09:00")
+
+ time.utc_offset.should == -9*60*60
+ time.zone.should == nil
+ time.to_i.should == @epoch_time
+ end
+
+ it "could be UTC offset as a number of seconds" do
+ time = Time.at(@epoch_time, in: 5*60*60)
+
+ time.utc_offset.should == 5*60*60
+ time.zone.should == nil
+ time.to_i.should == @epoch_time
+
+ time = Time.at(@epoch_time, in: -9*60*60)
+
+ time.utc_offset.should == -9*60*60
+ time.zone.should == nil
+ time.to_i.should == @epoch_time
+ end
+
+ it "could be a timezone object" do
+ zone = TimeSpecs::TimezoneWithName.new(name: "Asia/Colombo", offset: (5*3600+30*60))
+ time = Time.at(@epoch_time, in: zone)
+
+ time.utc_offset.should == 5*3600+30*60
+ time.zone.should == zone
+ time.to_i.should == @epoch_time
+
+ zone = TimeSpecs::TimezoneWithName.new(name: "PST", offset: (-9*60*60))
+ time = Time.at(@epoch_time, in: zone)
+
+ time.utc_offset.should == -9*60*60
+ time.zone.should == zone
+ time.to_i.should == @epoch_time
+ end
+ end
+ end
end
diff --git a/spec/ruby/core/time/fixtures/classes.rb b/spec/ruby/core/time/fixtures/classes.rb
index d89e4911c8..ece7ed2bca 100644
--- a/spec/ruby/core/time/fixtures/classes.rb
+++ b/spec/ruby/core/time/fixtures/classes.rb
@@ -9,18 +9,77 @@ module TimeSpecs
end
end
- Timezone = Struct.new(:name, :abbr, :offset)
class Timezone
- def utc_offset(t = nil)
- offset
+ def initialize(options)
+ @offset = options[:offset]
end
def local_to_utc(t)
- t - utc_offset(t)
+ t - @offset
end
def utc_to_local(t)
- t + utc_offset(t)
+ t + @offset
+ end
+ end
+
+ class TimezoneMethodCallRecorder < Timezone
+ def initialize(options, &blk)
+ super(options)
+ @blk = blk
+ end
+
+ def local_to_utc(t)
+ @blk.call(t)
+ super
+ end
+
+ def utc_to_local(t)
+ @blk.call(t)
+ super
+ end
+ end
+
+ class TimeLikeArgumentRecorder
+ def self.result
+ arguments = []
+
+ zone = TimeSpecs::TimezoneMethodCallRecorder.new(offset: 0) do |obj|
+ arguments << obj
+ end
+
+ # ensure timezone's methods are called at least once
+ Time.new(2000, 1, 1, 12, 0, 0, zone)
+
+ return arguments[0]
+ end
+ end
+
+ class TimezoneWithAbbr < Timezone
+ def initialize(options)
+ super
+ @abbr = options[:abbr]
+ end
+
+ def abbr(time)
+ @abbr
+ end
+ end
+
+ class TimezoneWithName < Timezone
+ def initialize(options)
+ super
+ @name = options[:name]
+ end
+
+ def name
+ @name
+ end
+ end
+
+ class TimeWithFindTimezone < Time
+ def self.find_timezone(name)
+ TimezoneWithName.new(name: name.to_s, offset: -10*60*60)
end
end
end
diff --git a/spec/ruby/core/time/getlocal_spec.rb b/spec/ruby/core/time/getlocal_spec.rb
index 87a412f41c..8b6a21bb58 100644
--- a/spec/ruby/core/time/getlocal_spec.rb
+++ b/spec/ruby/core/time/getlocal_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Time#getlocal" do
it "returns a new time which is the local representation of time" do
@@ -99,15 +100,69 @@ describe "Time#getlocal" do
ruby_version_is "2.6" do
describe "with a timezone argument" do
it "returns a Time in the timezone" do
- zone = mock('timezone')
- zone.should_receive(:utc_to_local).and_return(Time.utc(2000, 1, 1, 17, 30, 0))
- t = Time.utc(2000, 1, 1, 12, 0, 0)
- tv = t.to_i
- t = t.getlocal(zone)
- t.to_a[0, 6].should == [0, 30, 17, 1, 1, 2000]
- t.utc_offset.should == 19800
- t.to_i.should == tv
- t.zone.should == zone
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone)
+
+ time.zone.should == zone
+ time.utc_offset.should == 5*3600+30*60
+ end
+
+ it "accepts timezone argument that must have #local_to_utc and #utc_to_local methods" do
+ zone = Object.new
+ def zone.utc_to_local(time)
+ time
+ end
+ def zone.local_to_utc(time)
+ time
+ end
+
+ lambda {
+ Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone).should be_kind_of(Time)
+ }.should_not raise_error
+ end
+
+ it "raises TypeError if timezone does not implement #utc_to_local method" do
+ zone = Object.new
+ def zone.local_to_utc(time)
+ time
+ end
+
+ lambda {
+ Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone)
+ }.should raise_error(TypeError, /can't convert \w+ into an exact number/)
+ end
+
+ it "does not raise exception if timezone does not implement #local_to_utc method" do
+ zone = Object.new
+ def zone.utc_to_local(time)
+ time
+ end
+
+ lambda {
+ Time.utc(2000, 1, 1, 12, 0, 0).getlocal(zone).should be_kind_of(Time)
+ }.should_not raise_error
+ end
+
+ context "subject's class implements .find_timezone method" do
+ it "calls .find_timezone to build a time object if passed zone name as a timezone argument" do
+ time = TimeSpecs::TimeWithFindTimezone.utc(2000, 1, 1, 12, 0, 0).getlocal("Asia/Colombo")
+ time.zone.should be_kind_of TimeSpecs::TimezoneWithName
+ time.zone.name.should == "Asia/Colombo"
+
+ time = TimeSpecs::TimeWithFindTimezone.utc(2000, 1, 1, 12, 0, 0).getlocal("some invalid zone name")
+ time.zone.should be_kind_of TimeSpecs::TimezoneWithName
+ time.zone.name.should == "some invalid zone name"
+ end
+
+ it "does not call .find_timezone if passed any not string/numeric/timezone timezone argument" do
+ [Object.new, [], {}, :"some zone"].each do |zone|
+ time = TimeSpecs::TimeWithFindTimezone.utc(2000, 1, 1, 12, 0, 0)
+
+ lambda {
+ time.getlocal(zone)
+ }.should raise_error(TypeError, /can't convert \w+ into an exact number/)
+ end
+ end
end
end
end
diff --git a/spec/ruby/core/time/minus_spec.rb b/spec/ruby/core/time/minus_spec.rb
index 7c4b21f0d5..a47e726196 100644
--- a/spec/ruby/core/time/minus_spec.rb
+++ b/spec/ruby/core/time/minus_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Time#-" do
it "decrements the time by the specified amount" do
@@ -89,6 +90,25 @@ describe "Time#-" do
(Time.new(2012, 1, 1, 0, 0, 0, 3600) - 10).utc_offset.should == 3600
end
+ it "preserves time zone" do
+ time_with_zone = Time.now.utc
+ time_with_zone.zone.should == (time_with_zone - 60*60).zone
+
+ time_with_zone = Time.now
+ time_with_zone.zone.should == (time_with_zone - 60*60).zone
+ end
+
+ ruby_version_is "2.6" do
+ context "zone is a timezone object" do
+ it "preserves time zone" do
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.new(2012, 1, 1, 12, 0, 0, zone) - 60*60
+
+ time.zone.should == zone
+ end
+ end
+ end
+
it "does not return a subclass instance" do
c = Class.new(Time)
x = c.now + 1
diff --git a/spec/ruby/core/time/new_spec.rb b/spec/ruby/core/time/new_spec.rb
index 8d32c4e492..fe0e1aea31 100644
--- a/spec/ruby/core/time/new_spec.rb
+++ b/spec/ruby/core/time/new_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
require_relative 'shared/now'
require_relative 'shared/local'
require_relative 'shared/time_params'
@@ -116,12 +117,211 @@ end
ruby_version_is "2.6" do
describe "Time.new with a timezone argument" do
- it "returns a Time correspoinding to UTC time returned by local_to_utc" do
- zone = TimeSpecs::Timezone.new("Asia/Colombo", "MMT", (5*3600+30*60))
- t = Time.new(2000, 1, 1, 12, 0, 0, zone)
- t.to_a[0, 6].should == [0, 0, 12, 1, 1, 2000]
- t.utc_offset.should == 19800
- t.zone.should == zone
+ it "returns a Time in the timezone" do
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.new(2000, 1, 1, 12, 0, 0, zone)
+
+ time.zone.should == zone
+ time.utc_offset.should == 5*3600+30*60
+ end
+
+ it "accepts timezone argument that must have #local_to_utc and #utc_to_local methods" do
+ zone = Object.new
+ def zone.utc_to_local(time)
+ time
+ end
+ def zone.local_to_utc(time)
+ time
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
+ }.should_not raise_error
+ end
+
+ it "raises TypeError if timezone does not implement #local_to_utc method" do
+ zone = Object.new
+ def zone.utc_to_local(time)
+ time
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone)
+ }.should raise_error(TypeError, /can't convert \w+ into an exact number/)
+ end
+
+ it "does not raise exception if timezone does not implement #utc_to_local method" do
+ zone = Object.new
+ def zone.local_to_utc(time)
+ time
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
+ }.should_not raise_error
+ end
+
+ # The result also should be a Time or Time-like object (not necessary to be the same class)
+ # The zone of the result is just ignored
+ describe "returned value by #utc_to_local and #local_to_utc methods" do
+ it "could be Time instance" do
+ zone = Object.new
+ def zone.local_to_utc(t)
+ Time.utc(t.year, t.mon, t.day, t.hour - 1, t.min, t.sec)
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
+ Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
+ }.should_not raise_error
+ end
+
+ it "could be Time subclass instance" do
+ zone = Object.new
+ def zone.local_to_utc(t)
+ Class.new(Time).utc(t.year, t.mon, t.day, t.hour - 1, t.min, t.sec)
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
+ Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
+ }.should_not raise_error
+ end
+
+ it "could be any object with #to_i method" do
+ zone = Object.new
+ def zone.local_to_utc(time)
+ Struct.new(:to_i).new(time.to_i - 60*60)
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone).should be_kind_of(Time)
+ Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 60*60
+ }.should_not raise_error
+ end
+
+ it "could have any #zone and #utc_offset because they are ignored" do
+ zone = Object.new
+ def zone.local_to_utc(time)
+ Struct.new(:to_i, :zone, :utc_offset).new(time.to_i, 'America/New_York', -5*60*60)
+ end
+ Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 0
+
+ zone = Object.new
+ def zone.local_to_utc(time)
+ Struct.new(:to_i, :zone, :utc_offset).new(time.to_i, 'Asia/Tokyo', 9*60*60)
+ end
+ Time.new(2000, 1, 1, 12, 0, 0, zone).utc_offset.should == 0
+ end
+
+ it "leads to raising Argument error if difference between argument and result is too large" do
+ zone = Object.new
+ def zone.local_to_utc(t)
+ Time.utc(t.year, t.mon, t.day + 1, t.hour, t.min, t.sec)
+ end
+
+ lambda {
+ Time.new(2000, 1, 1, 12, 0, 0, zone)
+ }.should raise_error(ArgumentError, "utc_offset out of range")
+ end
+ end
+
+ # https://github.com/ruby/ruby/blob/v2_6_0/time.c#L5330
+ #
+ # Time-like argument to these methods is similar to a Time object in UTC without sub-second;
+ # it has attribute readers for the parts, e.g. year, month, and so on, and epoch time readers, to_i
+ #
+ # The sub-second attributes are fixed as 0, and utc_offset, zone, isdst, and their aliases are same as a Time object in UTC
+ describe "Time-like argument of #utc_to_local and #local_to_utc methods" do
+ before do
+ @obj = TimeSpecs::TimeLikeArgumentRecorder.result
+ @obj.should_not == nil
+ end
+
+ it "implements subset of Time methods" do
+ [
+ :year, :mon, :month, :mday, :hour, :min, :sec,
+ :tv_sec, :tv_usec, :usec, :tv_nsec, :nsec, :subsec,
+ :to_i, :to_f, :to_r, :+, :-,
+ :isdst, :dst?, :zone, :gmtoff, :gmt_offset, :utc_offset, :utc?, :gmt?,
+ :to_s, :inspect, :to_a, :to_time,
+ ].each do |name|
+ @obj.respond_to?(name).should == true
+ end
+ end
+
+ it "has attribute values the same as a Time object in UTC" do
+ @obj.usec.should == 0
+ @obj.nsec.should == 0
+ @obj.subsec.should == 0
+ @obj.tv_usec.should == 0
+ @obj.tv_nsec.should == 0
+
+ @obj.utc_offset.should == 0
+ @obj.zone.should == "UTC"
+ @obj.isdst.should == Time.new.utc.isdst
+ end
+ end
+
+ context "#name method" do
+ it "uses the optional #name method for marshaling" do
+ zone = TimeSpecs::TimezoneWithName.new(name: "Asia/Colombo", offset: (5*3600+30*60))
+ time = Time.new(2000, 1, 1, 12, 0, 0, zone)
+ time_loaded = Marshal.load(Marshal.dump(time))
+
+ time_loaded.zone.should == "Asia/Colombo"
+ time_loaded.utc_offset.should == 5*3600+30*60
+ end
+
+ it "cannot marshal Time if #name method isn't implemented" do
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.new(2000, 1, 1, 12, 0, 0, zone)
+
+ lambda {
+ Marshal.dump(time)
+ }.should raise_error(NoMethodError, /undefined method `name' for/)
+ end
+ end
+
+ it "the #abbr method is used by '%Z' in #strftime" do
+ zone = TimeSpecs::TimezoneWithAbbr.new(abbr: "MMT", offset: (5*3600+30*60))
+ time = Time.new(2000, 1, 1, 12, 0, 0, zone)
+
+ time.strftime("%Z").should == "MMT"
+ end
+
+ # At loading marshaled data, a timezone name will be converted to a timezone object
+ # by find_timezone class method, if the method is defined.
+ # Similary, that class method will be called when a timezone argument does not have
+ # the necessary methods mentioned above.
+ context "subject's class implements .find_timezone method" do
+ it "calls .find_timezone to build a time object at loading marshaled data" do
+ zone = TimeSpecs::TimezoneWithName.new(name: "Asia/Colombo", offset: (5*3600+30*60))
+ time = TimeSpecs::TimeWithFindTimezone.new(2000, 1, 1, 12, 0, 0, zone)
+ time_loaded = Marshal.load(Marshal.dump(time))
+
+ time_loaded.zone.should be_kind_of TimeSpecs::TimezoneWithName
+ time_loaded.zone.name.should == "Asia/Colombo"
+ time_loaded.utc_offset.should == 5*3600+30*60
+ end
+
+ it "calls .find_timezone to build a time object if passed zone name as a timezone argument" do
+ time = TimeSpecs::TimeWithFindTimezone.new(2000, 1, 1, 12, 0, 0, "Asia/Colombo")
+ time.zone.should be_kind_of TimeSpecs::TimezoneWithName
+ time.zone.name.should == "Asia/Colombo"
+
+ time = TimeSpecs::TimeWithFindTimezone.new(2000, 1, 1, 12, 0, 0, "some invalid zone name")
+ time.zone.should be_kind_of TimeSpecs::TimezoneWithName
+ time.zone.name.should == "some invalid zone name"
+ end
+
+ it "does not call .find_timezone if passed any not string/numeric/timezone timezone argument" do
+ [Object.new, [], {}, :"some zone"].each do |zone|
+ lambda {
+ TimeSpecs::TimeWithFindTimezone.new(2000, 1, 1, 12, 0, 0, zone)
+ }.should raise_error(TypeError, /can't convert \w+ into an exact number/)
+ end
+ end
end
end
end
diff --git a/spec/ruby/core/time/plus_spec.rb b/spec/ruby/core/time/plus_spec.rb
index 0861e9c9f6..91713b84b3 100644
--- a/spec/ruby/core/time/plus_spec.rb
+++ b/spec/ruby/core/time/plus_spec.rb
@@ -1,4 +1,5 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Time#+" do
it "increments the time by the specified amount" do
@@ -47,16 +48,22 @@ describe "Time#+" do
(Time.new(2012, 1, 1, 0, 0, 0, 3600) + 10).utc_offset.should == 3600
end
+ it "preserves time zone" do
+ time_with_zone = Time.now.utc
+ time_with_zone.zone.should == (time_with_zone + 60*60).zone
+
+ time_with_zone = Time.now
+ time_with_zone.zone.should == (time_with_zone + 60*60).zone
+ end
+
ruby_version_is "2.6" do
- it "returns a time with the same timezone as self" do
- zone = mock("timezone")
- zone.should_receive(:local_to_utc).and_return(Time.utc(2012, 1, 1, 6, 30, 0))
- zone.should_receive(:utc_to_local).and_return(Time.utc(2012, 1, 1, 12, 0, 10))
- t = Time.new(2012, 1, 1, 12, 0, 0, zone) + 10
- t.zone.should == zone
- t.utc_offset.should == 19800
- t.to_a[0, 6].should == [10, 0, 12, 1, 1, 2012]
- t.should == Time.utc(2012, 1, 1, 6, 30, 10)
+ context "zone is a timezone object" do
+ it "preserves time zone" do
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.new(2012, 1, 1, 12, 0, 0, zone) + 60*60
+
+ time.zone.should == zone
+ end
end
end
diff --git a/spec/ruby/core/time/succ_spec.rb b/spec/ruby/core/time/succ_spec.rb
index dace9b823e..395ed67064 100644
--- a/spec/ruby/core/time/succ_spec.rb
+++ b/spec/ruby/core/time/succ_spec.rb
@@ -1,19 +1,39 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "Time#succ" do
it "returns a new time one second later than time" do
- -> {
+ suppress_warning {
@result = Time.at(100).succ
- }.should complain(/Time#succ is obsolete/)
+ }
+
@result.should == Time.at(101)
end
it "returns a new instance" do
- t1 = Time.at(100)
- t2 = nil
- -> {
- t2 = t1.succ
+ time = Time.at(100)
+
+ suppress_warning {
+ @result = time.succ
+ }
+
+ @result.should_not equal time
+ end
+
+ it "is obsolete" do
+ lambda {
+ Time.at(100).succ
}.should complain(/Time#succ is obsolete/)
- t1.should_not equal t2
+ end
+
+ ruby_version_is "2.6" do
+ context "zone is a timezone object" do
+ it "preserves time zone" do
+ zone = TimeSpecs::Timezone.new(offset: (5*3600+30*60))
+ time = Time.new(2012, 1, 1, 12, 0, 0, zone) - 60*60
+
+ time.zone.should == zone
+ end
+ end
end
end
diff --git a/spec/ruby/core/tracepoint/enable_spec.rb b/spec/ruby/core/tracepoint/enable_spec.rb
index b1a8628896..3b43d3d6b4 100644
--- a/spec/ruby/core/tracepoint/enable_spec.rb
+++ b/spec/ruby/core/tracepoint/enable_spec.rb
@@ -99,4 +99,416 @@ describe 'TracePoint#enable' do
trace.enabled?.should be_false
end
end
+
+ ruby_version_is "2.6" do
+ describe 'target: option' do
+ before :each do
+ ScratchPad.record []
+ end
+
+ it 'enables trace point for specific location' do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ obj = Object.new
+ def obj.foo; end
+ def obj.bar; end
+
+ trace.enable(target: obj.method(:foo)) do
+ obj.foo
+ obj.bar
+ end
+
+ ScratchPad.recorded.should == [:foo]
+ end
+
+ it 'traces all the events triggered in specified location' do
+ trace = TracePoint.new(:line, :call, :return, :b_call, :b_return) do |tp|
+ ScratchPad << tp.event
+ end
+
+ obj = Object.new
+ def obj.foo
+ bar
+ -> {}.call
+ end
+ def obj.bar; end
+
+ trace.enable(target: obj.method(:foo)) do
+ obj.foo
+ end
+
+ ScratchPad.recorded.uniq.sort.should == [:call, :return, :b_call, :b_return, :line].sort
+ end
+
+ it 'does not trace events in nested locations' do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ obj = Object.new
+ def obj.foo
+ bar
+ end
+ def obj.bar
+ baz
+ end
+ def obj.baz
+ end
+
+ trace.enable(target: obj.method(:foo)) do
+ obj.foo
+ end
+
+ ScratchPad.recorded.should == [:foo]
+ end
+
+ it "traces some events in nested blocks" do
+ klass = Class.new do
+ def foo
+ 1.times do
+ 1.times do
+ bar do
+ end
+ end
+ end
+ end
+
+ def bar(&blk)
+ blk.call
+ end
+ end
+
+ trace = TracePoint.new(:b_call) do |tp|
+ ScratchPad << tp.lineno
+ end
+
+ obj = klass.new
+ _, lineno = obj.method(:foo).source_location
+
+ trace.enable(target: obj.method(:foo)) do
+ obj.foo
+ end
+
+ ScratchPad.recorded.should == (lineno+1..lineno+3).to_a
+ end
+
+ describe 'option value' do
+ it 'excepts Method' do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ obj = Object.new
+ def obj.foo; end
+
+ trace.enable(target: obj.method(:foo)) do
+ obj.foo
+ end
+
+ ScratchPad.recorded.should == [:foo]
+ end
+
+ it 'excepts UnboundMethod' do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ klass = Class.new do
+ def foo; end
+ end
+
+ unbound_method = klass.instance_method(:foo)
+ trace.enable(target: unbound_method) do
+ klass.new.foo
+ end
+
+ ScratchPad.recorded.should == [:foo]
+ end
+
+ it 'excepts Proc' do
+ trace = TracePoint.new(:b_call) do |tp|
+ ScratchPad << tp.lineno
+ end
+
+ block = proc {}
+ _, lineno = block.source_location
+
+ trace.enable(target: block) do
+ block.call
+ end
+
+ ScratchPad.recorded.should == [lineno]
+ lineno.should be_kind_of(Integer)
+ end
+
+ it 'excepts RubyVM::InstructionSequence' do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ obj = Object.new
+ def obj.foo; end
+
+ iseq = RubyVM::InstructionSequence.of(obj.method(:foo))
+ trace.enable(target: iseq) do
+ obj.foo
+ end
+
+ ScratchPad.recorded.should == [:foo]
+ end
+ end
+
+ it "raises ArgumentError when passed object isn't consisted of InstructionSequence (iseq)" do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ core_method = 'foo bar'.method(:bytes)
+ RubyVM::InstructionSequence.of(core_method).should == nil
+
+ lambda {
+ trace.enable(target: core_method) do
+ end
+ }.should raise_error(ArgumentError, /specified target is not supported/)
+ end
+
+ it "raises ArgumentError if target object cannot trigger specified event" do
+ trace = TracePoint.new(:call) do |tp|
+ ScratchPad << tp.method_id
+ end
+
+ block = proc {}
+
+ lambda {
+ trace.enable(target: block) do
+ block.call # triggers :b_call and :b_return events
+ end
+ }.should raise_error(ArgumentError, /can not enable any hooks/)
+ end
+
+ it "raises ArgumentError if passed not Method/UnboundMethod/Proc/RubyVM::InstructionSequence" do
+ trace = TracePoint.new(:call) do |tp|
+ end
+
+ lambda {
+ trace.enable(target: Object.new) do
+ end
+ }.should raise_error(ArgumentError, /specified target is not supported/)
+ end
+
+ context "nested enabling and disabling" do
+ it "raises ArgumentError if trace point already enabled with target is re-enabled with target" do
+ trace = TracePoint.new(:b_call) do
+ end
+
+ lambda {
+ trace.enable(target: -> {}) do
+ trace.enable(target: -> {}) do
+ end
+ end
+ }.should raise_error(ArgumentError, /can't nest-enable a targetting TracePoint/)
+ end
+
+ it "raises ArgumentError if trace point already enabled without target is re-enabled with target" do
+ trace = TracePoint.new(:b_call) do
+ end
+
+ lambda {
+ trace.enable do
+ trace.enable(target: -> {}) do
+ end
+ end
+ }.should raise_error(ArgumentError, /can't nest-enable a targetting TracePoint/)
+ end
+
+ it "raises ArgumentError if trace point already enabled with target is re-enabled without target" do
+ trace = TracePoint.new(:b_call) do
+ end
+
+ lambda {
+ trace.enable(target: -> {}) do
+ trace.enable do
+ end
+ end
+ }.should raise_error(ArgumentError, /can't nest-enable a targetting TracePoint/)
+ end
+
+ it "raises ArgumentError if trace point already enabled with target is disabled with block" do
+ trace = TracePoint.new(:b_call) do
+ end
+
+ lambda {
+ trace.enable(target: -> {}) do
+ trace.disable do
+ end
+ end
+ }.should raise_error(ArgumentError, /can't disable a targetting TracePoint in a block/)
+ end
+
+ it "traces events when trace point with target is enabled in another trace point enabled without target" do
+ trace_outer = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :outer
+ end
+
+ trace_inner = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :inner
+ end
+
+ target = -> {}
+
+ trace_outer.enable do
+ trace_inner.enable(target: target) do
+ target.call
+ end
+ end
+
+ ScratchPad.recorded.should == [:outer, :outer, :outer, :inner]
+ end
+
+ it "traces events when trace point with target is enabled in another trace point enabled with target" do
+ trace_outer = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :outer
+ end
+
+ trace_inner = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :inner
+ end
+
+ target = -> {}
+
+ trace_outer.enable(target: target) do
+ trace_inner.enable(target: target) do
+ target.call
+ end
+ end
+
+ ScratchPad.recorded.should == [:inner, :outer]
+ end
+
+ it "traces events when trace point without target is enabled in another trace point enabled with target" do
+ trace_outer = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :outer
+ end
+
+ trace_inner = TracePoint.new(:b_call) do |tp|
+ ScratchPad << :inner
+ end
+
+ target = -> {}
+
+ trace_outer.enable(target: target) do
+ trace_inner.enable do
+ target.call
+ end
+ end
+
+ ScratchPad.recorded.should == [:inner, :inner, :outer]
+ end
+ end
+ end
+
+ describe 'target_line: option' do
+ before :each do
+ ScratchPad.record []
+ end
+
+ it "traces :line events only on specified line of code" do
+ trace = TracePoint.new(:line) do |tp|
+ ScratchPad << tp.lineno
+ end
+
+ target = -> {
+ x = 1
+ y = 2 # <= this line is target
+ z = x + y
+ }
+ _, lineno = target.source_location
+ target_line = lineno + 2
+
+ trace.enable(target_line: target_line, target: target) do
+ target.call
+ end
+
+ ScratchPad.recorded.should == [target_line]
+ end
+
+ it "raises ArgumentError if :target option isn't specified" do
+ trace = TracePoint.new(:line) do |tp|
+ end
+
+ lambda {
+ trace.enable(target_line: 67) do
+ end
+ }.should raise_error(ArgumentError, /only target_line is specified/)
+ end
+
+ it "raises ArgumentError if :line event isn't registered" do
+ trace = TracePoint.new(:call) do |tp|
+ end
+
+ target = -> {
+ x = 1
+ y = 2 # <= this line is target
+ z = x + y
+ }
+ _, lineno = target.source_location
+ target_line = lineno + 2
+
+ lambda {
+ trace.enable(target_line: target_line, target: target) do
+ end
+ }.should raise_error(ArgumentError, /target_line is specified, but line event is not specified/)
+ end
+
+ it "raises ArgumentError if :target_line value is out of target code lines range" do
+ trace = TracePoint.new(:line) do |tp|
+ end
+
+ lambda {
+ trace.enable(target_line: 1, target: -> { }) do
+ end
+ }.should raise_error(ArgumentError, /can not enable any hooks/)
+ end
+
+ it "raises TypeError if :target_line value couldn't be coerced to Integer" do
+ trace = TracePoint.new(:line) do |tp|
+ end
+
+ lambda {
+ trace.enable(target_line: Object.new, target: -> { }) do
+ end
+ }.should raise_error(TypeError, /no implicit conversion of \w+? into Integer/)
+ end
+
+ it "raises ArgumentError if :target_line value is negative" do
+ trace = TracePoint.new(:line) do |tp|
+ end
+
+ lambda {
+ trace.enable(target_line: -2, target: -> { }) do
+ end
+ }.should raise_error(ArgumentError, /can not enable any hooks/)
+ end
+
+ it "excepts value that could be coerced to Integer" do
+ trace = TracePoint.new(:line) do |tp|
+ ScratchPad << tp.lineno
+ end
+
+ target = -> {
+ x = 1 # <= this line is target
+ }
+ _, lineno = target.source_location
+ target_line = lineno + 1
+
+ trace.enable(target_line: target_line.to_r, target: target) do
+ target.call
+ end
+
+ ScratchPad.recorded.should == [target_line]
+ end
+ end
+ end
end
diff --git a/spec/ruby/language/block_spec.rb b/spec/ruby/language/block_spec.rb
index e35b0ed767..95fd74ce26 100644
--- a/spec/ruby/language/block_spec.rb
+++ b/spec/ruby/language/block_spec.rb
@@ -36,7 +36,7 @@ describe "A block yielded a single" do
m([1, 2]) { |a=5, b=4, c=3| [a, b, c] }.should == [1, 2, 3]
end
- it "assgins elements to post arguments" do
+ it "assigns elements to post arguments" do
m([1, 2]) { |a=5, b, c, d| [a, b, c, d] }.should == [5, 1, 2, nil]
end
@@ -250,7 +250,7 @@ describe "A block" do
end
describe "taking |a, b| arguments" do
- it "assgins nil to the arguments when no values are yielded" do
+ it "assigns nil to the arguments when no values are yielded" do
@y.z { |a, b| [a, b] }.should == [nil, nil]
end
@@ -454,7 +454,7 @@ describe "A block" do
@y.z { |a, | a }.should be_nil
end
- it "assgins the argument a single value yielded" do
+ it "assigns the argument a single value yielded" do
@y.s(1) { |a, | a }.should == 1
end
diff --git a/spec/ruby/language/defined_spec.rb b/spec/ruby/language/defined_spec.rb
index 6616758011..a36ebf9a74 100644
--- a/spec/ruby/language/defined_spec.rb
+++ b/spec/ruby/language/defined_spec.rb
@@ -30,12 +30,12 @@ describe "The defined? keyword for literals" do
end
it "returns nil if one element is not defined" do
- ret = defined?([NonExistantConstant, Array])
+ ret = defined?([NonExistentConstant, Array])
ret.should == nil
end
it "returns nil if all elements are not defined" do
- ret = defined?([NonExistantConstant, AnotherNonExistantConstant])
+ ret = defined?([NonExistentConstant, AnotherNonExistentConstant])
ret.should == nil
end
diff --git a/spec/ruby/language/optional_assignments_spec.rb b/spec/ruby/language/optional_assignments_spec.rb
index 2f50136ba9..29103c67fd 100644
--- a/spec/ruby/language/optional_assignments_spec.rb
+++ b/spec/ruby/language/optional_assignments_spec.rb
@@ -251,7 +251,7 @@ describe 'Optional variable assignments' do
end
end
- describe 'using compunded constants' do
+ describe 'using compounded constants' do
before :each do
Object.send(:remove_const, :A) if defined? Object::A
end
diff --git a/spec/ruby/language/private_spec.rb b/spec/ruby/language/private_spec.rb
index d9cfb1c3d0..e7a871b09b 100644
--- a/spec/ruby/language/private_spec.rb
+++ b/spec/ruby/language/private_spec.rb
@@ -45,7 +45,7 @@ describe "The private keyword" do
lambda { f.foo }.should raise_error(NoMethodError)
end
- it "changes visiblity of previously called methods with same send/call site" do
+ it "changes visibility of previously called methods with same send/call site" do
g = ::Private::G.new
lambda {
2.times do
diff --git a/spec/ruby/language/proc_spec.rb b/spec/ruby/language/proc_spec.rb
index 4026f3bcf5..c44e711d2b 100644
--- a/spec/ruby/language/proc_spec.rb
+++ b/spec/ruby/language/proc_spec.rb
@@ -21,7 +21,7 @@ describe "A Proc" do
@l.call.should == 1
end
- it "raises an ArgumentErro if a value is passed" do
+ it "raises an ArgumentError if a value is passed" do
lambda { @l.call(0) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/language/regexp/escapes_spec.rb b/spec/ruby/language/regexp/escapes_spec.rb
index a4a9cb1793..17501af8c6 100644
--- a/spec/ruby/language/regexp/escapes_spec.rb
+++ b/spec/ruby/language/regexp/escapes_spec.rb
@@ -67,7 +67,7 @@ describe "Regexps with escape characters" do
/\cJ/.match("\r").should be_nil
# Parsing precedence
- /\cJ+/.match("\n\n").to_a.should == ["\n\n"] # Quantifers apply to entire escape sequence
+ /\cJ+/.match("\n\n").to_a.should == ["\n\n"] # Quantifiers apply to entire escape sequence
/\\cJ/.match("\\cJ").to_a.should == ["\\cJ"]
lambda { eval('/[abc\x]/') }.should raise_error(SyntaxError) # \x is treated as a escape sequence even inside a character class
# Syntax error
diff --git a/spec/ruby/language/regexp/modifiers_spec.rb b/spec/ruby/language/regexp/modifiers_spec.rb
index 65c9c24ceb..7c78e67e2b 100644
--- a/spec/ruby/language/regexp/modifiers_spec.rb
+++ b/spec/ruby/language/regexp/modifiers_spec.rb
@@ -1,7 +1,7 @@
require_relative '../../spec_helper'
require_relative '../fixtures/classes'
-describe "Regexps with modifers" do
+describe "Regexps with modifiers" do
it "supports /i (case-insensitive)" do
/foo/i.match("FOO").to_a.should == ["FOO"]
end
diff --git a/spec/ruby/language/regexp/repetition_spec.rb b/spec/ruby/language/regexp/repetition_spec.rb
index 07004d8190..5d400dec6f 100644
--- a/spec/ruby/language/regexp/repetition_spec.rb
+++ b/spec/ruby/language/regexp/repetition_spec.rb
@@ -45,7 +45,7 @@ describe "Regexps with repetition" do
it "does not treat {m,n}+ as possessive" do
-> {
@regexp = eval "/foo(A{0,1}+)Abar/"
- }.should complain(/nested repeat operato/)
+ }.should complain(/nested repeat operator/)
@regexp.match("fooAAAbar").to_a.should == ["fooAAAbar", "AA"]
end
end
diff --git a/spec/ruby/language/regexp_spec.rb b/spec/ruby/language/regexp_spec.rb
index 6da29ee7a2..6fcf81107c 100644
--- a/spec/ruby/language/regexp_spec.rb
+++ b/spec/ruby/language/regexp_spec.rb
@@ -97,7 +97,7 @@ describe "Literal Regexps" do
it "supports (?> ) (embedded subexpression)" do
/(?>foo)(?>bar)/.match("foobar").to_a.should == ["foobar"]
- /(?>foo*)obar/.match("foooooooobar").should be_nil # it is possesive
+ /(?>foo*)obar/.match("foooooooobar").should be_nil # it is possessive
end
it "supports (?# )" do
diff --git a/spec/ruby/language/send_spec.rb b/spec/ruby/language/send_spec.rb
index 8bef80173c..84d02afb82 100644
--- a/spec/ruby/language/send_spec.rb
+++ b/spec/ruby/language/send_spec.rb
@@ -6,10 +6,10 @@ require_relative 'fixtures/send'
# will verify special and generic arity code paths for all impls.
#
# Method naming conventions:
-# M - Manditory Args
+# M - Mandatory Args
# O - Optional Arg
# R - Rest Arg
-# Q - Post Manditory Args
+# Q - Post Mandatory Args
specs = LangSendSpecs
diff --git a/spec/ruby/language/until_spec.rb b/spec/ruby/language/until_spec.rb
index ddeb5d01e4..78c289ff56 100644
--- a/spec/ruby/language/until_spec.rb
+++ b/spec/ruby/language/until_spec.rb
@@ -220,7 +220,7 @@ describe "The until modifier with begin .. end block" do
a.should == [0, 1, 2, 4]
end
- it "restart the current iteration without reevaluting condition with redo" do
+ it "restart the current iteration without reevaluating condition with redo" do
a = []
i = 0
j = 0
diff --git a/spec/ruby/language/while_spec.rb b/spec/ruby/language/while_spec.rb
index 02c52c780f..e172453ca6 100644
--- a/spec/ruby/language/while_spec.rb
+++ b/spec/ruby/language/while_spec.rb
@@ -330,7 +330,7 @@ describe "The while modifier with begin .. end block" do
a.should == [0, 1, 2, 4]
end
- it "restarts the current iteration without reevaluting condition with redo" do
+ it "restarts the current iteration without reevaluating condition with redo" do
a = []
i = 0
j = 0
diff --git a/spec/ruby/library/bigdecimal/divmod_spec.rb b/spec/ruby/library/bigdecimal/divmod_spec.rb
index 3a18b150dd..3946d6f208 100644
--- a/spec/ruby/library/bigdecimal/divmod_spec.rb
+++ b/spec/ruby/library/bigdecimal/divmod_spec.rb
@@ -163,7 +163,7 @@ describe "BigDecimal#divmod" do
end
end
- it "returns an array of two zero if the diviend is zero" do
+ it "returns an array of two zero if the dividend is zero" do
@zeroes.each do |zero|
@regular_vals.each do |val|
zero.divmod(val).should == [@zero, @zero]
diff --git a/spec/ruby/library/bigdecimal/sqrt_spec.rb b/spec/ruby/library/bigdecimal/sqrt_spec.rb
index 06a8348203..75182fcbc8 100644
--- a/spec/ruby/library/bigdecimal/sqrt_spec.rb
+++ b/spec/ruby/library/bigdecimal/sqrt_spec.rb
@@ -87,7 +87,7 @@ describe "BigDecimal#sqrt" do
}.should raise_error(FloatDomainError)
end
- it "returns positive infitinity for infinity" do
+ it "returns positive infinity for infinity" do
@infinity.sqrt(1).should == @infinity
end
diff --git a/spec/ruby/library/cgi/rfc1123_date_spec.rb b/spec/ruby/library/cgi/rfc1123_date_spec.rb
index d94c026d9f..6904eeabaa 100644
--- a/spec/ruby/library/cgi/rfc1123_date_spec.rb
+++ b/spec/ruby/library/cgi/rfc1123_date_spec.rb
@@ -1,7 +1,7 @@
require_relative '../../spec_helper'
require 'cgi'
-describe "CGI.rfc1123_date when passsed Time" do
+describe "CGI.rfc1123_date when passed Time" do
it "returns the passed Time formatted in RFC1123 ('Sat, 01 Dec 2007 15:56:42 GMT')" do
input = Time.at(1196524602)
expected = 'Sat, 01 Dec 2007 15:56:42 GMT'
diff --git a/spec/ruby/library/datetime/to_date_spec.rb b/spec/ruby/library/datetime/to_date_spec.rb
index a1b93305b8..48c05e7fed 100644
--- a/spec/ruby/library/datetime/to_date_spec.rb
+++ b/spec/ruby/library/datetime/to_date_spec.rb
@@ -30,7 +30,7 @@ describe "DateTime#to_date" do
it "maintains the same julian day regardless of local time or zone" do
dt = DateTime.new(2012, 12, 24, 12, 23, 00, '+05:00')
- with_timezone("Pactific/Pago_Pago", -11) do
+ with_timezone("Pacific/Pago_Pago", -11) do
dt.to_date.jd.should == dt.jd
end
end
diff --git a/spec/ruby/library/datetime/to_s_spec.rb b/spec/ruby/library/datetime/to_s_spec.rb
index c6b5bd90be..175fb807f4 100644
--- a/spec/ruby/library/datetime/to_s_spec.rb
+++ b/spec/ruby/library/datetime/to_s_spec.rb
@@ -10,7 +10,7 @@ describe "DateTime#to_s" do
it "maintains timezone regardless of local time" do
dt = DateTime.new(2012, 12, 24, 1, 2, 3, "+03:00")
- with_timezone("Pactific/Pago_Pago", -11) do
+ with_timezone("Pacific/Pago_Pago", -11) do
dt.to_s.should == "2012-12-24T01:02:03+03:00"
end
end
diff --git a/spec/ruby/library/datetime/to_time_spec.rb b/spec/ruby/library/datetime/to_time_spec.rb
index 1844cbd7eb..3bda369ca7 100644
--- a/spec/ruby/library/datetime/to_time_spec.rb
+++ b/spec/ruby/library/datetime/to_time_spec.rb
@@ -22,7 +22,7 @@ describe "DateTime#to_time" do
it "preserves the same time regardless of local time or zone" do
date = DateTime.new(2012, 12, 24, 12, 23, 00, '+03:00')
- with_timezone("Pactific/Pago_Pago", -11) do
+ with_timezone("Pacific/Pago_Pago", -11) do
time = date.to_time
time.utc_offset.should == 3 * 3600
diff --git a/spec/ruby/library/delegate/delegator/frozen_spec.rb b/spec/ruby/library/delegate/delegator/frozen_spec.rb
index ca83c5f77c..bc91259b08 100644
--- a/spec/ruby/library/delegate/delegator/frozen_spec.rb
+++ b/spec/ruby/library/delegate/delegator/frozen_spec.rb
@@ -17,7 +17,7 @@ describe "Delegator when frozen" do
@delegate.frozen?.should be_true
end
- it "is not writeable" do
+ it "is not writable" do
lambda{ @delegate[0] += 2 }.should raise_error( RuntimeError )
end
diff --git a/spec/ruby/library/getoptlong/terminate_spec.rb b/spec/ruby/library/getoptlong/terminate_spec.rb
index 287945fe9b..a12d1df2ef 100644
--- a/spec/ruby/library/getoptlong/terminate_spec.rb
+++ b/spec/ruby/library/getoptlong/terminate_spec.rb
@@ -19,7 +19,7 @@ describe "GetoptLong#terminate" do
end
end
- it "returns self when option processsing is terminated" do
+ it "returns self when option processing is terminated" do
@opts.terminate.should == @opts
end
diff --git a/spec/ruby/library/logger/logger/new_spec.rb b/spec/ruby/library/logger/logger/new_spec.rb
index cf965ac03b..3a83968eb1 100644
--- a/spec/ruby/library/logger/logger/new_spec.rb
+++ b/spec/ruby/library/logger/logger/new_spec.rb
@@ -37,7 +37,7 @@ describe "Logger#new" do
lambda { Logger.new(@log_file, 1).close }.should_not raise_error
end
- it "receivs a maximum logfile size as third argument" do
+ it "receives a maximum logfile size as third argument" do
# This should create 2 small log files, logfile_test and logfile_test.0
# in /tmp, each one with a different message.
path = tmp("logfile_test.log")
diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb
index 8d47bed5e6..7552b7616c 100644
--- a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb
+++ b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb
@@ -8,7 +8,7 @@ describe "Matrix::EigenvalueDecomposition#eigenvalues" do
[ Complex(1, -1), Complex(1, 1)]
end
- it "returns an array of real eigenvalues for a symetric matrix" do
+ it "returns an array of real eigenvalues for a symmetric matrix" do
Matrix[[1, 2],
[2, 1]].eigensystem.eigenvalues.sort.map!{|x| x.round(10)}.should ==
[ -1, 3 ]
diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb
index 38217ca373..09f229ee15 100644
--- a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb
+++ b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb
@@ -10,7 +10,7 @@ describe "Matrix::EigenvalueDecomposition#eigenvector_matrix" do
[Complex(0, 1), Complex(0, -1)]]
end
- it "returns an real eigenvector matrix for a symetric matrix" do
+ it "returns an real eigenvector matrix for a symmetric matrix" do
# Fix me: should test for linearity, not for equality
Matrix[[1, 2],
[2, 1]].eigensystem.eigenvector_matrix.should ==
diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb
index 968d02e27c..2b6ce74ea8 100644
--- a/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb
+++ b/spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb
@@ -11,7 +11,7 @@ describe "Matrix::EigenvalueDecomposition#eigenvectors" do
]
end
- it "returns an array of real eigenvectors for a symetric matrix" do
+ it "returns an array of real eigenvectors for a symmetric matrix" do
# Fix me: should test for linearity, not for equality
Matrix[[1, 2],
[2, 1]].eigensystem.eigenvectors.should ==
diff --git a/spec/ruby/library/net/ftp/quit_spec.rb b/spec/ruby/library/net/ftp/quit_spec.rb
index fdc3a2f795..8e3cb28b90 100644
--- a/spec/ruby/library/net/ftp/quit_spec.rb
+++ b/spec/ruby/library/net/ftp/quit_spec.rb
@@ -22,7 +22,7 @@ describe "Net::FTP#quit" do
@ftp.last_response.should == "221 OK, bye\n"
end
- it "does not close the socket automagically" do
+ it "does not close the socket automatically" do
@ftp.quit
@ftp.closed?.should be_false
end
diff --git a/spec/ruby/library/net/http/http/proxy_class_spec.rb b/spec/ruby/library/net/http/http/proxy_class_spec.rb
index 2aab804ed3..2d32a39f01 100644
--- a/spec/ruby/library/net/http/http/proxy_class_spec.rb
+++ b/spec/ruby/library/net/http/http/proxy_class_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../../../spec_helper'
require 'net/http'
describe "Net::HTTP.proxy_class?" do
- it "returns true if sels is a class created with Net::HTTP.Proxy" do
+ it "returns true if self is a class created with Net::HTTP.Proxy" do
Net::HTTP.proxy_class?.should be_false
Net::HTTP.Proxy("localhost").proxy_class?.should be_true
end
diff --git a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
index 500155eb5b..a050eca594 100644
--- a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
+++ b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb
@@ -76,7 +76,7 @@ describe "Net::HTTPResponse#read_body" do
end
describe "when passed buffer and block" do
- it "rauses an ArgumentError" do
+ it "raises an ArgumentError" do
@res.reading_body(@socket, true) do
lambda { @res.read_body("") {} }.should raise_error(ArgumentError)
end
diff --git a/spec/ruby/library/openstruct/frozen_spec.rb b/spec/ruby/library/openstruct/frozen_spec.rb
index 27931fe5ac..142adcb278 100644
--- a/spec/ruby/library/openstruct/frozen_spec.rb
+++ b/spec/ruby/library/openstruct/frozen_spec.rb
@@ -14,7 +14,7 @@ describe "OpenStruct.new when frozen" do
@os.name.should == "John Smith"
end
- it "is not writeable" do
+ it "is not writable" do
lambda{ @os.age = 42 }.should raise_error( RuntimeError )
end
diff --git a/spec/ruby/library/rexml/attribute/initialize_spec.rb b/spec/ruby/library/rexml/attribute/initialize_spec.rb
index 3452b6c864..9f5e30c517 100644
--- a/spec/ruby/library/rexml/attribute/initialize_spec.rb
+++ b/spec/ruby/library/rexml/attribute/initialize_spec.rb
@@ -19,7 +19,7 @@ describe "REXML::Attribute#initialize" do
copy.should == @name
end
- it "recives a parent node" do
+ it "receives a parent node" do
last_name = REXML::Attribute.new("last_name", "McBrain", @e)
last_name.element.should == @e
diff --git a/spec/ruby/library/securerandom/hex_spec.rb b/spec/ruby/library/securerandom/hex_spec.rb
index 1e647edebc..525b4d1e35 100644
--- a/spec/ruby/library/securerandom/hex_spec.rb
+++ b/spec/ruby/library/securerandom/hex_spec.rb
@@ -3,7 +3,7 @@ require_relative '../../spec_helper'
require 'securerandom'
describe "SecureRandom.hex" do
- it "generates a random hex string of length twice the specified argement" do
+ it "generates a random hex string of length twice the specified argument" do
(1..64).each do |idx|
hex = SecureRandom.hex(idx)
hex.should be_kind_of(String)
diff --git a/spec/ruby/library/set/enumerable/to_set_spec.rb b/spec/ruby/library/set/enumerable/to_set_spec.rb
index 6d81710a2f..0f5504fef2 100644
--- a/spec/ruby/library/set/enumerable/to_set_spec.rb
+++ b/spec/ruby/library/set/enumerable/to_set_spec.rb
@@ -1,7 +1,7 @@
require_relative '../../../spec_helper'
require 'set'
-describe "Emumerable#to_set" do
+describe "Enumerable#to_set" do
it "returns a new Set created from self" do
[1, 2, 3].to_set.should == Set[1, 2, 3]
{a: 1, b: 2}.to_set.should == Set[[:b, 2], [:a, 1]]
diff --git a/spec/ruby/library/set/exclusion_spec.rb b/spec/ruby/library/set/exclusion_spec.rb
index 407aa70032..c9fa0e287e 100644
--- a/spec/ruby/library/set/exclusion_spec.rb
+++ b/spec/ruby/library/set/exclusion_spec.rb
@@ -6,7 +6,7 @@ describe "Set#^" do
@set = Set[1, 2, 3, 4]
end
- it "returns a new Set containing elements that are not in both self and the passed Enumberable" do
+ it "returns a new Set containing elements that are not in both self and the passed Enumerable" do
(@set ^ Set[3, 4, 5]).should == Set[1, 2, 5]
(@set ^ [3, 4, 5]).should == Set[1, 2, 5]
end
diff --git a/spec/ruby/library/set/sortedset/exclusion_spec.rb b/spec/ruby/library/set/sortedset/exclusion_spec.rb
index 59f7615e83..59f9f1dfd8 100644
--- a/spec/ruby/library/set/sortedset/exclusion_spec.rb
+++ b/spec/ruby/library/set/sortedset/exclusion_spec.rb
@@ -6,7 +6,7 @@ describe "SortedSet#^" do
@set = SortedSet[1, 2, 3, 4]
end
- it "returns a new SortedSet containing elements that are not in both self and the passed Enumberable" do
+ it "returns a new SortedSet containing elements that are not in both self and the passed Enumerable" do
(@set ^ SortedSet[3, 4, 5]).should == SortedSet[1, 2, 5]
(@set ^ [3, 4, 5]).should == SortedSet[1, 2, 5]
end
diff --git a/spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb b/spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb
index 81a68d3d13..bdd14c1b00 100644
--- a/spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb
+++ b/spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb
@@ -7,7 +7,7 @@ describe "Addrinfo#ipv4_multicast?" do
Addrinfo.ip('239.255.255.250').ipv4_multicast?.should == true
end
- it 'returns false for a regular addrss' do
+ it 'returns false for a regular address' do
Addrinfo.ip('8.8.8.8').ipv4_multicast?.should == false
end
diff --git a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
index bf93cd977e..50763e28b1 100644
--- a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
+++ b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb
@@ -25,7 +25,7 @@ with_feature :ancillary_data do
@data.cmsg_is?(:SOCKET, :RIGHTS).should == false
end
- it 'raises SocketError when comparign with :IPV6 and :RIGHTS' do
+ it 'raises SocketError when comparing with :IPV6 and :RIGHTS' do
lambda { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/basicsocket/getsockname_spec.rb b/spec/ruby/library/socket/basicsocket/getsockname_spec.rb
index a2c5980a9e..b33db088b6 100644
--- a/spec/ruby/library/socket/basicsocket/getsockname_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/getsockname_spec.rb
@@ -7,7 +7,7 @@ describe "Socket::BasicSocket#getsockname" do
@socket.close
end
- it "returns the sockaddr associacted with the socket" do
+ it "returns the sockaddr associated with the socket" do
@socket = TCPServer.new("127.0.0.1", 0)
sockaddr = Socket.unpack_sockaddr_in(@socket.getsockname)
sockaddr.should == [@socket.addr[1], "127.0.0.1"]
diff --git a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
index 2ee35af5b5..8e14707d4f 100644
--- a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
+++ b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb
@@ -17,11 +17,9 @@ describe "Socket::IPSocket#getaddress" do
# There is no way to make this fail-proof on all machines, because
# DNS servers like opendns return A records for ANY host, including
# traditionally invalidly named ones.
- quarantine! do
- it "raises an error on unknown hostnames" do
- lambda {
- IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
- }.should raise_error(SocketError)
- end
+ it "raises an error on unknown hostnames" do
+ lambda {
+ IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
+ }.should raise_error(SocketError)
end
end
diff --git a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
index ec57b40970..e39c8a0570 100644
--- a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
+++ b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb
@@ -16,7 +16,7 @@ describe "UNIXSocket#peeraddr" do
SocketSpecs.rm_socket @path
end
- it "returns the address familly and path of the server end of the connection" do
+ it "returns the address family and path of the server end of the connection" do
@client.peeraddr.should == ["AF_UNIX", @path]
end
diff --git a/spec/ruby/library/syslog/log_spec.rb b/spec/ruby/library/syslog/log_spec.rb
index f92f69ea92..727fffbadf 100644
--- a/spec/ruby/library/syslog/log_spec.rb
+++ b/spec/ruby/library/syslog/log_spec.rb
@@ -23,7 +23,7 @@ platform_is_not :windows do
}.should output_to_fd("rubyspec: Hello\nrubyspec: World\n", $stderr)
end
- it "accepts undefined priorites" do
+ it "accepts undefined priorities" do
lambda {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s|
s.log(1337, "Hello")
diff --git a/spec/ruby/library/tempfile/initialize_spec.rb b/spec/ruby/library/tempfile/initialize_spec.rb
index a3614971a1..ad3c2f6437 100644
--- a/spec/ruby/library/tempfile/initialize_spec.rb
+++ b/spec/ruby/library/tempfile/initialize_spec.rb
@@ -28,7 +28,7 @@ describe "Tempfile#initialize" do
end
platform_is_not :windows do
- it "sets the permisssions on the tempfile to 0600" do
+ it "sets the permissions on the tempfile to 0600" do
@tempfile.send(:initialize, "basename", tmp(""))
File.stat(@tempfile.path).mode.should == 0100600
end
diff --git a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
index 6f56f60425..a619f386a6 100644
--- a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
+++ b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
@@ -99,7 +99,7 @@ describe "Dir.mktmpdir when passed [Array]" do
Dir.rmdir @tmpdir if File.directory? @tmpdir
end
- it "uses the first element of the passed Array as a prefix and the scond element as a suffix to the tmp-directory" do
+ it "uses the first element of the passed Array as a prefix and the second element as a suffix to the tmp-directory" do
prefix = "before"
suffix = "after"
diff --git a/spec/ruby/library/uri/plus_spec.rb b/spec/ruby/library/uri/plus_spec.rb
index 146cfddf90..4aede12216 100644
--- a/spec/ruby/library/uri/plus_spec.rb
+++ b/spec/ruby/library/uri/plus_spec.rb
@@ -31,7 +31,7 @@ describe "URI#+" do
(URI.parse('http://a/b/c/../../../') + ".").should == URI("http://a/")
end
- it "doesn't conconicalize the path when adding to the empty string" do
+ it "doesn't canonicalize the path when adding to the empty string" do
(URI.parse('http://a/b/c/../') + "").should == URI("http://a/b/c/../")
end
diff --git a/spec/ruby/library/weakref/weakref_alive_spec.rb b/spec/ruby/library/weakref/weakref_alive_spec.rb
index 5bd7c3166b..173ea01485 100644
--- a/spec/ruby/library/weakref/weakref_alive_spec.rb
+++ b/spec/ruby/library/weakref/weakref_alive_spec.rb
@@ -8,7 +8,7 @@ describe "WeakRef#weakref_alive?" do
ref.weakref_alive?.should == true
end
- it "returns a falsey value if the object is no longer reachable" do
+ it "returns a falsy value if the object is no longer reachable" do
ref = WeakRefSpec.make_dead_weakref
[false, nil].should include(ref.weakref_alive?)
end
diff --git a/spec/ruby/library/yaml/parse_file_spec.rb b/spec/ruby/library/yaml/parse_file_spec.rb
index 8d307c5daf..8c59a2d7ef 100644
--- a/spec/ruby/library/yaml/parse_file_spec.rb
+++ b/spec/ruby/library/yaml/parse_file_spec.rb
@@ -2,9 +2,7 @@ require_relative '../../spec_helper'
require_relative 'fixtures/common'
describe "YAML#parse_file" do
- quarantine! do
- it "returns a YAML::Syck::Map object after parsing a YAML file" do
- YAML.parse_file($test_parse_file).should be_kind_of(YAML::Syck::Map)
- end
+ it "returns a YAML::Syck::Map object after parsing a YAML file" do
+ YAML.parse_file($test_parse_file).should be_kind_of(Psych::Nodes::Document)
end
end
diff --git a/spec/ruby/library/zlib/gzipreader/read_spec.rb b/spec/ruby/library/zlib/gzipreader/read_spec.rb
index a90b2bf498..67672eb0b8 100644
--- a/spec/ruby/library/zlib/gzipreader/read_spec.rb
+++ b/spec/ruby/library/zlib/gzipreader/read_spec.rb
@@ -49,7 +49,7 @@ describe "GzipReader#read" do
end
describe "at the end of data" do
- it "returns empty string if length prameter is not specified or 0" do
+ it "returns empty string if length parameter is not specified or 0" do
gz = Zlib::GzipReader.new @io
gz.read # read till the end
gz.read(0).should == ""
@@ -57,7 +57,7 @@ describe "GzipReader#read" do
gz.read(nil).should == ""
end
- it "returns nil if length prameter is positive" do
+ it "returns nil if length parameter is positive" do
gz = Zlib::GzipReader.new @io
gz.read # read till the end
gz.read(1).should be_nil