rspec - Test if a method is called by an object -


i new rspec , rails. want test execute method won't called if run method not run confirm true. how should write rspec test?

class release    def run(confirm=false)     execute if confirm   end    def execute     #   end 

end

it "should not execute without confirmation"   release = release.new   release.run   expect(release).not_to have_received(:execute) end 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -