Skip to content

Instantly share code, notes, and snippets.

@s0enke
Created May 16, 2014 01:48
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 s0enke/3e3014781e15428573f7 to your computer and use it in GitHub Desktop.
Save s0enke/3e3014781e15428573f7 to your computer and use it in GitHub Desktop.
trying to merge a `let` from included context
require 'rspec'
shared_context 'test' do
let(:something) {['something']}
end
describe 'something' do
include_context 'test'
let(:something) { super().merge(['another']) }
it 'should merge something' do
something.should == ['something', 'another']
end
end
@s0enke
Copy link
Author

s0enke commented May 16, 2014

leads to:

something
  should merge something (FAILED - 1)

Failures:

  1) something should merge something
     Failure/Error: let(:something) { super().merge(['another']) }
     NoMethodError:
       super: no superclass method `something' for #<RSpec::Core::ExampleGroup::Nested_1:0x0000000242e0f8>
     # ./test.rb:9:in `block (2 levels) in <top (required)>'
     # ./test.rb:12:in `block (2 levels) in <top (required)>'

Finished in 0.00046 seconds
1 example, 1 failure

Failed examples:

rspec ./test.rb:11 # something should merge something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment