ruby on rails - How to not execute a stubbed method in RSpec -


i testing controller calls method in module includes. don't want method execute, verify called. have right is:

it 'calls create_show_and_tickets'   sign_in create :admin   expect(subject).to receive(:create_show_and_tickets)    post :create, show: valid_attributes end 

in test not putting proper parameters in, throwing error when tries iterate on object doesn't exist. there way make sure create_show_and_tickets not execute?

is there way make sure create_show_and_tickets not execute?

you have done calling

expect(subject).to receive(:create_show_and_tickets) 

... before post. allow have same effect. in either case underlying code replaced mock or stub, , not called.

you can put debugging statement within create_show_and_tickets confirm this.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -