diff options
Diffstat (limited to 'spec/ruby/core/true')
-rw-r--r-- | spec/ruby/core/true/singleton_method_spec.rb | 15 | ||||
-rw-r--r-- | spec/ruby/core/true/to_s_spec.rb | 12 |
2 files changed, 20 insertions, 7 deletions
diff --git a/spec/ruby/core/true/singleton_method_spec.rb b/spec/ruby/core/true/singleton_method_spec.rb new file mode 100644 index 0000000000..c06793850f --- /dev/null +++ b/spec/ruby/core/true/singleton_method_spec.rb @@ -0,0 +1,15 @@ +require_relative '../../spec_helper' + +describe "TrueClass#singleton_method" do + ruby_version_is '3.3' do + it "raises regardless of whether TrueClass defines the method" do + -> { true.singleton_method(:foo) }.should raise_error(NameError) + begin + def (true).foo; end + -> { true.singleton_method(:foo) }.should raise_error(NameError) + ensure + TrueClass.send(:remove_method, :foo) + end + end + end +end diff --git a/spec/ruby/core/true/to_s_spec.rb b/spec/ruby/core/true/to_s_spec.rb index f26cd138e2..fa1b53a580 100644 --- a/spec/ruby/core/true/to_s_spec.rb +++ b/spec/ruby/core/true/to_s_spec.rb @@ -5,13 +5,11 @@ describe "TrueClass#to_s" do true.to_s.should == "true" end - ruby_version_is "2.7" do - it "returns a frozen string" do - true.to_s.should.frozen? - end + it "returns a frozen string" do + true.to_s.should.frozen? + end - it "always returns the same string" do - true.to_s.should equal(true.to_s) - end + it "always returns the same string" do + true.to_s.should equal(true.to_s) end end |