forked from jruby/jruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RE: jruby#2635 Fix support of const_get with leading colons
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
spec/regression/GH-2635_const_get_with_leading_colons_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe ".const_get" do | ||
|
||
module Example | ||
class Foo | ||
Bar = "bar" | ||
end | ||
end | ||
|
||
context "with leading colons" do | ||
it "finds the toplevel constant" do | ||
Object.const_get("::Example").should == Example | ||
end | ||
|
||
it "works with arbitrarily nested constants" do | ||
Object.const_get("::Example::Foo::Bar").should == "bar" | ||
end | ||
end | ||
|
||
end |