ruby - How can I check if my subject raises an exception? -
I am currently creating an object in the topic
and it needs to be checked whether it Generate an exception The following code shows what I am trying to achieve:
Describe MyClass 'Get started' topic {MyClass.new} This { Is_expected.not_to raise_error (some :: error)} end of end
I think I'm going wrong about this.
Update
P> My problem was twice the first, this syntax Does not work: this {is_expected.not_to_your_error}
hope
using this
Block, however (as told by Jimmy Quadra):
It does not raise an error 'expect {subject} .not_to raise_error end
< P> I am not very familiar with RSPC to tell you why this is why it is. Second, because, using raise_error
is possible with a specific error class. Therefore, it is invalid:
hope {topic}. For more information, see
If I understand correctly, then you are trying to test that an exception is caused by instantly transforming a class You will do the same:
Describes MyClass "Instant" does not increase the exception when making an appointment "Expect to {subject} .not_to raise_error end end
< / Pre>
Comments
Post a Comment