Created
August 16, 2018 16:24
-
-
Save DavidS/b178c2443943c35a53262eeaac94237a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 theallows