aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2011-02-24 15:10:14 +0000
committerLouise Crow <louise.crow@gmail.com>2011-02-24 15:10:14 +0000
commit08a64f9e3139851fd65c7ba6969ee590b4afea6a (patch)
tree20c77e796002dfa95b2af3ba00ebd2f691c02fc7 /vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility
parent3757bb52c0aa86b779b00428d7ebe35b30cea1ee (diff)
Adding rspec gem.
Diffstat (limited to 'vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility')
-rw-r--r--vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility/access_to_constants_spec.rb85
1 files changed, 85 insertions, 0 deletions
diff --git a/vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility/access_to_constants_spec.rb b/vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility/access_to_constants_spec.rb
new file mode 100644
index 000000000..b34b8ba6d
--- /dev/null
+++ b/vendor/gems/rspec-1.3.1/examples/ruby1.9.compatibility/access_to_constants_spec.rb
@@ -0,0 +1,85 @@
+# courtesy of Matthias Hennemeyer
+#
+# The following should pass against ruby 1.8 and 1.9. It currently only passes
+# 1.8 (as of 1/2/2009)
+#
+# Once cucumber supports ruby 1.9, this should be moved to cucumber scenarios instead.
+module Foo
+ module Bar
+
+ module ModuleInEnclosingModule;end
+ class ClassInEnclosingModule;end
+ def method_in_enclosing_module;end
+ CONSTANT_IN_ENCLOSING_MODULE = 0
+
+ describe "Examples trying to access constants defined in an enclosing module" do
+
+ it "can access Modules" do
+ ModuleInEnclosingModule
+ end
+ it "can access Classes" do
+ ClassInEnclosingModule.new
+ end
+ it "can access CONSTANTS" do
+ CONSTANT_IN_ENCLOSING_MODULE
+ end
+ it "can NOT access methods" do
+ lambda {method_in_enclosing_module}.should raise_error(/undefined/)
+ end
+
+ describe "from a nested example group" do
+
+ it "can access Modules" do
+ ModuleInEnclosingModule
+ end
+ it "can access Classes" do
+ ClassInEnclosingModule.new
+ end
+ it "can access CONSTANTS" do
+ CONSTANT_IN_ENCLOSING_MODULE
+ end
+ it "can NOT access methods" do
+ lambda {method_in_enclosing_module}.should raise_error(/undefined/)
+ end
+
+ end
+
+ end
+
+ describe "Examples trying to access constants defined in the example group" do
+
+ module ModuleDefinedInGroup;end
+ class ClassDefinedInGroup; end
+ def method_defined_in_group; end
+ CONSTANT_DEFINED_IN_GROUP = 0
+
+ it "can access Modules" do
+ ModuleDefinedInGroup
+ end
+ it "can access Classes" do
+ ClassDefinedInGroup.new
+ end
+ it "can access CONSTANTS" do
+ CONSTANT_DEFINED_IN_GROUP
+ end
+ it "can access methods" do
+ method_defined_in_group
+ end
+
+ describe "that live inside a nested group" do
+ it "can access Modules" do
+ ModuleDefinedInGroup
+ end
+ it "can access Classes" do
+ ClassDefinedInGroup.new
+ end
+ it "can access CONSTANTS" do
+ CONSTANT_DEFINED_IN_GROUP
+ end
+ it "can access methods" do
+ method_defined_in_group
+ end
+ end
+ end
+ end
+end