There is a scenario where I have multiple keys with the same value so to avoid that repetition I have done something like below

sports = [:cricket,:football,:basketball,:baseball,:rugby,:swimming,:table_tennis,:soccer,:karate]

final_hash =

sports.each{|d| final_hash[d] = [], count: [], user_hash: {}, sport_count: [],  options: {}, period: "",stat_type: "" )  }

Now I want to pass this hash in my double block but Whenever I do so I get an error

context 'For users details Page' do
  it 'should give the data' do
    ###now I want to pass the hash SO can anyone guide me how can I do it
    presenter =  double(UserPresenter, id: 1, sector_name: nil, final_hash)

1 Answers

Aniket Shivam Tiwari On

As suggested by @engineersmnky making use of double splat operator(**hash) over hash worked for me.