-
-
Save DavidS/b178c2443943c35a53262eeaac94237a to your computer and use it in GitHub Desktop.
describe 'something' do | |
let(:route) { instance_double('Net::IP::Route', 'route') } | |
before(:each) do | |
allow(Net::IP::Route).to receive(:new).with({ test: 'data' }).and_return(route) | |
end | |
it 'doesn't suck' do | |
expect(Net::IP).to receive(:routes).with(route) | |
provider.create(context, name, {input: 'foo'}) | |
end | |
end |
I suspect the allow
s not to match. change them to an expect temporarily?
Also double check, maybe even pry into, that your code is doing the right thing. in long debugging sessions things can get lost
Switching to expect
results in the same error.
Using pry, I don't see anything out of the ordinary, but seeing as puppet_munge is called by the create method, is allow(provider).to receive(:puppet_munge).with('should').and_return('munged')
even the correct way to mock the results of that method?
none of the allows/expects are failing, it's failing specifically on provider.create()
in the test. Almost like that line partially ignores the allows
Method being tested for reference purposes: https://github.com/dhollinger/puppet-network/blob/resource_refactor/lib/puppet/provider/network_route/network_route.rb#L78
To wrap up this thread, after some online debugging we found a missing stub, causing this.
Ugh, this is getting infuriating:
With the changes you suggested. Reading the code, it looks like it should work, but I get this: