aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library')
-rw-r--r--spec/ruby/library/date/constants_spec.rb4
-rw-r--r--spec/ruby/library/mathn/mathn_spec.rb9
-rw-r--r--spec/ruby/library/set/compare_by_identity_spec.rb4
-rw-r--r--spec/ruby/library/stringio/initialize_spec.rb4
-rw-r--r--spec/ruby/library/stringio/open_spec.rb4
-rw-r--r--spec/ruby/library/stringio/reopen_spec.rb4
-rw-r--r--spec/ruby/library/stringio/shared/read.rb4
-rw-r--r--spec/ruby/library/weakref/fixtures/classes.rb3
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb2
9 files changed, 23 insertions, 15 deletions
diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb
index ae343f07ec..8c31b056d8 100644
--- a/spec/ruby/library/date/constants_spec.rb
+++ b/spec/ruby/library/date/constants_spec.rb
@@ -36,11 +36,11 @@ describe "Date constants" do
[Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary|
lambda {
ary << "Unknown"
- }.should raise_error(RuntimeError, /frozen/)
+ }.should raise_error(frozen_error_class, /frozen/)
ary.compact.each do |name|
lambda {
name << "modified"
- }.should raise_error(RuntimeError, /frozen/)
+ }.should raise_error(frozen_error_class, /frozen/)
end
end
end
diff --git a/spec/ruby/library/mathn/mathn_spec.rb b/spec/ruby/library/mathn/mathn_spec.rb
new file mode 100644
index 0000000000..aedf88ea7b
--- /dev/null
+++ b/spec/ruby/library/mathn/mathn_spec.rb
@@ -0,0 +1,9 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "mathn" do
+ ruby_version_is "2.5" do
+ it "is no longer part of the standard library" do
+ -> { require "mathn" }.should raise_error(LoadError)
+ end
+ end
+end
diff --git a/spec/ruby/library/set/compare_by_identity_spec.rb b/spec/ruby/library/set/compare_by_identity_spec.rb
index 437af9dd0b..2a62880a9d 100644
--- a/spec/ruby/library/set/compare_by_identity_spec.rb
+++ b/spec/ruby/library/set/compare_by_identity_spec.rb
@@ -92,11 +92,11 @@ ruby_version_is '2.4' do
set.to_a.sort.should == [a1, a2].sort
end
- it "raises a RuntimeError on frozen sets" do
+ it "raises a #{frozen_error_class} on frozen sets" do
set = Set.new.freeze
lambda {
set.compare_by_identity
- }.should raise_error(RuntimeError, /frozen Hash/)
+ }.should raise_error(frozen_error_class, /frozen Hash/)
end
it "persists over #dups" do
diff --git a/spec/ruby/library/stringio/initialize_spec.rb b/spec/ruby/library/stringio/initialize_spec.rb
index 8b661a3790..face3a510a 100644
--- a/spec/ruby/library/stringio/initialize_spec.rb
+++ b/spec/ruby/library/stringio/initialize_spec.rb
@@ -110,9 +110,9 @@ describe "StringIO#initialize when passed [Object, mode]" do
io.closed_write?.should be_false
end
- it "raises a RuntimeError when passed a frozen String in truncate mode as StringIO backend" do
+ it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
io = StringIO.allocate
- lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(RuntimeError)
+ lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
diff --git a/spec/ruby/library/stringio/open_spec.rb b/spec/ruby/library/stringio/open_spec.rb
index 136ff5f972..95b715e583 100644
--- a/spec/ruby/library/stringio/open_spec.rb
+++ b/spec/ruby/library/stringio/open_spec.rb
@@ -134,8 +134,8 @@ describe "StringIO.open when passed [Object, mode]" do
io.closed_write?.should be_false
end
- it "raises a RuntimeError when passed a frozen String in truncate mode as StringIO backend" do
- lambda { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do
+ lambda { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "tries to convert the passed mode to a String using #to_str" do
diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb
index abdecdf9de..00e14f3425 100644
--- a/spec/ruby/library/stringio/reopen_spec.rb
+++ b/spec/ruby/library/stringio/reopen_spec.rb
@@ -48,8 +48,8 @@ describe "StringIO#reopen when passed [Object, Integer]" do
lambda { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES)
end
- it "raises a RuntimeError when trying to reopen self with a frozen String in truncate-mode" do
- lambda { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} when trying to reopen self with a frozen String in truncate-mode" do
+ lambda { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class)
end
it "does not raise IOError when passed a frozen String in read-mode" do
diff --git a/spec/ruby/library/stringio/shared/read.rb b/spec/ruby/library/stringio/shared/read.rb
index 025829a2b1..604bf880e5 100644
--- a/spec/ruby/library/stringio/shared/read.rb
+++ b/spec/ruby/library/stringio/shared/read.rb
@@ -27,8 +27,8 @@ describe :stringio_read, shared: true do
lambda { @io.send(@method, 7, Object.new) }.should raise_error(TypeError)
end
- it "raises an error when passed a frozen String as buffer" do
- lambda { @io.send(@method, 7, "".freeze) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} error when passed a frozen String as buffer" do
+ lambda { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/library/weakref/fixtures/classes.rb b/spec/ruby/library/weakref/fixtures/classes.rb
index 560c58b041..9a1d3ce370 100644
--- a/spec/ruby/library/weakref/fixtures/classes.rb
+++ b/spec/ruby/library/weakref/fixtures/classes.rb
@@ -15,8 +15,7 @@ class WeakRefSpec
weak = nil
10_000.times do
weaks << make_weakref
- GC.start
- GC.start
+ 10.times { GC.start }
break if weak = weaks.find { |w| !w.weakref_alive? }
end
weak
diff --git a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
index e436441409..f94e48c051 100644
--- a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
+++ b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb
@@ -12,7 +12,7 @@ platform_is :windows do
end
it "returns expected value for Scripting Runtime's 'name' method" do
- pointer_size = RUBY_PLATFORM =~ /\bx64\b/ ? 64 : 1.size * 8
+ pointer_size = PlatformGuard::POINTER_SIZE
@m_file_name.offset_vtbl.should == pointer_size
end