mercredi 5 août 2015

How to assert that a Rails method will not throw a NoMethodError

In my Rails application I am doing a unit test where I expect an error when calling a certain method.

test "sending a logout request while not logged should not return an error" do
  assert_nothing_raised do
    do_a_logout
  end
end

Problem is that the test keeps reporting as Error instead as of Failure when do_a_logout errors out.

Aucun commentaire:

Enregistrer un commentaire