Skip to content

Commit

Permalink
Add specs for Kernel#taint, #tainted? and #untaint
Browse files Browse the repository at this point in the history
  • Loading branch information
AI-Mozi committed May 17, 2023
1 parent a3b248a commit 56b97b5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion core/kernel/taint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative 'fixtures/classes'

describe "Kernel#taint" do
ruby_version_is ""..."3.0" do
ruby_version_is ""..."3.1" do
it "is a no-op" do
o = Object.new
o.taint
Expand All @@ -16,4 +16,10 @@
}.should complain(/Object#taint is deprecated and will be removed in Ruby 3.2/, verbose: true)
end
end

ruby_version_is "3.2" do
it "has been removed" do
Object.new.should_not.respond_to?(:taint)
end
end
end
8 changes: 7 additions & 1 deletion core/kernel/tainted_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative 'fixtures/classes'

describe "Kernel#tainted?" do
ruby_version_is ""..."3.0" do
ruby_version_is ""..."3.1" do
it "is a no-op" do
o = mock('o')
p = mock('p')
Expand All @@ -18,4 +18,10 @@
}.should complain(/Object#tainted\? is deprecated and will be removed in Ruby 3.2/, verbose: true)
end
end

ruby_version_is "3.2" do
it "has been removed" do
Object.new.should_not.respond_to?(:tainted?)
end
end
end
8 changes: 7 additions & 1 deletion core/kernel/untaint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative 'fixtures/classes'

describe "Kernel#untaint" do
ruby_version_is ""..."3.0" do
ruby_version_is ""..."3.1" do
it "is a no-op" do
o = Object.new.taint
o.should_not.tainted?
Expand All @@ -17,4 +17,10 @@
}.should complain(/Object#untaint is deprecated and will be removed in Ruby 3.2/, verbose: true)
end
end

ruby_version_is "3.2" do
it "has been removed" do
Object.new.should_not.respond_to?(:untaint)
end
end
end

0 comments on commit 56b97b5

Please sign in to comment.