I have a unit test where I was stubbing place.ext_fb_place_id using
let(:place) { stub(:place, ext_fb_place_id: SecureRandom.random_number(20_000_000), facebook_metadata: {category: nil}, lat: 33.129147303422, lng: -96.653188420995, name: "In & Out Burger") }
I had to change my code to use the string key instead of the dot operator. That is, I had to use place["ext_fb_place_id'] to get the correct value. However, this throws the following error:
Stub :place received unexpected message :[] with ("ext_fb_place_id")
How do I stub the [] method so that I can use calls like place["ext_fb_place_id"] or place["lat"]?
Thanks
I was able to stub with the following:
Thanks to @LeeJarvis and @JimDeville.