I'm trying to mock some data inside before(:each)
and get
NoMethodError:
undefined method `receive_message' for #<RSpec::ExampleGroups::CurrencyExchange:0x007f87c652f3c8>
my before(:each
before(:each) do
@rates = {"exchangerates"=>
{"row"=>
[{"exchangerate"=>{"ccy"=>"EUR", "base_ccy"=>"UAH", "buy"=>"28.33917", "sale"=>"28.33917"}},
{"exchangerate"=>{"ccy"=>"RUR", "base_ccy"=>"UAH", "buy"=>"0.38685", "sale"=>"0.38685"}},
{"exchangerate"=>{"ccy"=>"USD", "base_ccy"=>"UAH", "buy"=>"24.88293", "sale"=>"24.88293"}},
{"exchangerate"=>{"ccy"=>"BTC", "base_ccy"=>"USD", "buy"=>"605.3695", "sale"=>"669.0926"}}]}}
obj = double()
@request = allow(obj).to receive_message(@rates)
end
How to fix it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…