Hi

I'd expect the code you provided to work, and having tested it in a plain 
spec it does. 

I assume you mean without the context inside the helper you'd like to 
override the node_params, which you can't do because its like (and in fact 
is) redefining a method, where as describe/context blocks create inherited 
classes.

You could of course, use a before block to mutate node params in this 
example however.

Cheers
Jon


On Thursday, 9 February 2023 at 12:58:37 UTC ger...@gmail.com wrote:

> Hi,
>
> I have an unusual case where I need to do something like this:
>
>   def helper
>     context 'another context' do
>       let(:node_params) do
>         # I would like to merge with the
>         # the other node_params hash here
>         # but this doesn't work because 
>         # there's no super() yet.
>         super().merge(
>           {
>             :y => 1,
>           }
>         )
>       end
>
>       it 'some test' do
>       end
>     end
>   end
>
>   describe 'something' do
>     # define node params
>     let(:node_params) do
>       {
>         :x => 1,
>       }
>     end
>     # call helper
>     helper
>   end
>
> The helper function needs to get access to the node_params from the 
> calling context (:x => 1), but i can't seem to be to do it. If I surround 
> the call to helper with another context, then it will work.
>
> Curious if there are elegant solutions to this. Thanks!!
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rspec+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/1c1e7c69-bcda-4001-ab06-3d7fc2b6f2ddn%40googlegroups.com.

Reply via email to