diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/language/defined_spec.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/ruby/language/defined_spec.rb b/spec/ruby/language/defined_spec.rb index eae0b03573..9fe460a9de 100644 --- a/spec/ruby/language/defined_spec.rb +++ b/spec/ruby/language/defined_spec.rb @@ -766,8 +766,16 @@ describe "The defined? keyword for a scoped constant" do defined?(DefinedSpecs::String).should be_nil end - it "returns nil when a constant is defined on top-level but not on the class" do - defined?(DefinedSpecs::Basic::String).should be_nil + ruby_version_is ""..."2.5" do + it "returns 'constant' when a constant is defined on top-level but not on the class" do + defined?(DefinedSpecs::Basic::String).should == 'constant' + end + end + + ruby_version_is "2.5" do + it "returns nil when a constant is defined on top-level but not on the class" do + defined?(DefinedSpecs::Basic::String).should be_nil + end end it "returns 'constant' if the scoped-scoped constant is defined" do |