summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringio')
-rw-r--r--spec/ruby/library/stringio/append_spec.rb8
-rw-r--r--spec/ruby/library/stringio/reopen_spec.rb40
-rw-r--r--spec/ruby/library/stringio/shared/write.rb8
3 files changed, 33 insertions, 23 deletions
diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb
index c46dc59ee5..b35d17ed31 100644
--- a/spec/ruby/library/stringio/append_spec.rb
+++ b/spec/ruby/library/stringio/append_spec.rb
@@ -36,9 +36,11 @@ describe "StringIO#<< when passed [Object]" do
end
end
- it "does not taint self when the passed argument is tainted" do
- (@io << "test".taint)
- @io.tainted?.should be_false
+ ruby_version_is ""..."2.8" do
+ it "does not taint self when the passed argument is tainted" do
+ (@io << "test".taint)
+ @io.tainted?.should be_false
+ end
end
it "updates self's position" do
diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb
index 34e38a63b4..64fd0a8c02 100644
--- a/spec/ruby/library/stringio/reopen_spec.rb
+++ b/spec/ruby/library/stringio/reopen_spec.rb
@@ -23,13 +23,15 @@ describe "StringIO#reopen when passed [Object, Integer]" do
@io.string.should == "reopened, another time"
end
- # NOTE: WEIRD!
- it "does not taint self when the passed Object was tainted" do
- @io.reopen("reopened".taint, IO::RDONLY)
- @io.tainted?.should be_false
-
- @io.reopen("reopened".taint, IO::WRONLY)
- @io.tainted?.should be_false
+ ruby_version_is ""..."2.8" do
+ # NOTE: WEIRD!
+ it "does not taint self when the passed Object was tainted" do
+ @io.reopen("reopened".taint, IO::RDONLY)
+ @io.tainted?.should be_false
+
+ @io.reopen("reopened".taint, IO::WRONLY)
+ @io.tainted?.should be_false
+ end
end
it "tries to convert the passed Object to a String using #to_str" do
@@ -90,13 +92,15 @@ describe "StringIO#reopen when passed [Object, Object]" do
str.should == ""
end
- # NOTE: WEIRD!
- it "does not taint self when the passed Object was tainted" do
- @io.reopen("reopened".taint, "r")
- @io.tainted?.should be_false
+ ruby_version_is ""..."2.8" do
+ # NOTE: WEIRD!
+ it "does not taint self when the passed Object was tainted" do
+ @io.reopen("reopened".taint, "r")
+ @io.tainted?.should be_false
- @io.reopen("reopened".taint, "w")
- @io.tainted?.should be_false
+ @io.reopen("reopened".taint, "w")
+ @io.tainted?.should be_false
+ end
end
it "tries to convert the passed Object to a String using #to_str" do
@@ -160,10 +164,12 @@ describe "StringIO#reopen when passed [String]" do
@io.string.should == "reopened"
end
- # NOTE: WEIRD!
- it "does not taint self when the passed Object was tainted" do
- @io.reopen("reopened".taint)
- @io.tainted?.should be_false
+ ruby_version_is ""..."2.8" do
+ # NOTE: WEIRD!
+ it "does not taint self when the passed Object was tainted" do
+ @io.reopen("reopened".taint)
+ @io.tainted?.should be_false
+ end
end
it "resets self's position to 0" do
diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb
index 28683e3cb1..dc5e1442ec 100644
--- a/spec/ruby/library/stringio/shared/write.rb
+++ b/spec/ruby/library/stringio/shared/write.rb
@@ -52,9 +52,11 @@ describe :stringio_write_string, shared: true do
end
end
- it "does not taint self when the passed argument is tainted" do
- @io.send(@method, "test".taint)
- @io.tainted?.should be_false
+ ruby_version_is ""..."2.8" do
+ it "does not taint self when the passed argument is tainted" do
+ @io.send(@method, "test".taint)
+ @io.tainted?.should be_false
+ end
end
end