Rails ActiveSupport: How to assert that an error is raised?
问题 I am wanting to test a function on one of my models that throws specific errors. The function looks something like this: def merge(release_to_delete) raise "Can't merge a release with itself!" if( self.id == release_to_delete.id ) raise "Can only merge releases by the same artist" if( self.artist != release_to_delete.artist ) #actual merge code here end Now I want to do an assert that when I call this function with a parameter that causes each of those exceptions, that the exceptions actually