Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created August 22, 2010 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/543381 to your computer and use it in GitHub Desktop.
Save myronmarston/543381 to your computer and use it in GitHub Desktop.
ruby-1.8.6-p399 ➜ rvm use 1.8.6
info: Using ruby 1.8.6 p399
ruby-1.8.6-p399 ➜ ruby rspec_constant_spec.rb
.
Finished in 0.00083 seconds
1 example, 0 failures
ruby-1.8.6-p399 ➜ rvm use 1.8.7
info: Using ruby 1.8.7 p302
ruby-1.8.7-p302 ➜ ruby rspec_constant_spec.rb
.
Finished in 0.00085 seconds
1 example, 0 failures
ruby-1.8.7-p302 ➜ rvm use 1.9.1
info: Using ruby 1.9.1 p378
ruby-1.9.1-p378 ➜ ruby rspec_constant_spec.rb
F
Failures:
1) MyClass returns the expected value from #foo
Failure/Error: subject.foo.should == EXPECTED_VALUE
uninitialized constant RSpec::Core::ExampleGroup::Nested_1::EXPECTED_VALUE
# rspec_constant_spec.rb:9:in `block in define_spec'
Finished in 0.00238 seconds
1 example, 1 failure
ruby-1.9.1-p378 ➜ rvm use 1.9.2
info: Using ruby 1.9.2 p0
ruby-1.9.2-p0 ➜ ruby rspec_constant_spec.rb
.
Finished in 0.00183 seconds
1 example, 0 failures
require 'rubygems'
require 'rspec'
module MySpecs
EXPECTED_VALUE = 7
def define_spec
it "returns the expected value from #foo" do
subject.foo.should == EXPECTED_VALUE
end
end
end
class MyClass
def foo; 7; end
end
describe MyClass do
extend MySpecs
define_spec
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment