Expect Exceptions to be raised in rspec
expect { object.some_method("Stupid Monkey") }.to raise_error
expect { object.some_other_method }.to raise_error "Awful exception"
expect { object.method("argparty") }.to raise_error ErrorClass
Written by Ed
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#