Skip to content

Instantly share code, notes, and snippets.

@s0enke

s0enke/test.rb

Created May 16, 2014
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@s0enke 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