diff options
Diffstat (limited to 'spec/ruby/fixtures/constants.rb')
| -rw-r--r-- | spec/ruby/fixtures/constants.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/ruby/fixtures/constants.rb b/spec/ruby/fixtures/constants.rb index 37271ddcc8..7f0b88daab 100644 --- a/spec/ruby/fixtures/constants.rb +++ b/spec/ruby/fixtures/constants.rb @@ -10,7 +10,7 @@ # variety in class and module configurations, including hierarchy, # containment, inclusion, singletons and toplevel. # -# Constants are numbered for for uniqueness. The CS_ prefix is uniformly used +# Constants are numbered for uniqueness. The CS_ prefix is uniformly used # and is to minimize clashes with other toplevel constants (see e.g. ModuleA # which is included in Object). Constant values are symbols. A numbered suffix # is used to distinguish constants with the same name defined in different @@ -44,6 +44,7 @@ module ConstantSpecs # Included in ParentA module ModuleB + LINE = __LINE__ - 1 CS_CONST10 = :const10_9 CS_CONST11 = :const11_2 CS_CONST12 = :const12_1 @@ -75,12 +76,19 @@ module ConstantSpecs CS_CONST10 = :const10_8 end + # Included in ContainerA + module ModuleIncludePrepended + prepend ModuleD + + CS_CONST11 = :const11_8 + end + # The following classes/modules have all the constants set "statically". # Contrast with the classes below where the constants are set as the specs # are run. class ClassA - CS_CLASS_A_LINE = __LINE__ - 1 + LINE = __LINE__ - 1 CS_CONST10 = :const10_10 CS_CONST10_LINE = __LINE__ - 1 CS_CONST16 = :const16 @@ -169,6 +177,10 @@ module ConstantSpecs def const10; CS_CONST10; end end + class ContainerPrepend + include ModuleIncludePrepended + end + class ContainerA::ChildA def self.const23; CS_CONST23; end end @@ -299,4 +311,14 @@ module ConstantSpecs private_constant :CS_PRIVATE end +module ConstantSpecsThree + module ConstantSpecsTwo + Foo = :cs_three_foo + end +end + +module ConstantSpecsTwo + Foo = :cs_two_foo +end + include ConstantSpecs::ModuleA |
