【发布时间】:2012-12-12 04:47:51
【问题描述】:
我写了一个测试,我希望结果会抛出一个错误。
it{ Authentication.create_with_omniauth!(nil, nil).should raise_error }
结果确实抛出了错误,但是验证失败。显然它正在抛出一个错误。 :)
2) Authentication methods: self.create_with_omniauth!: with bad input
Failure/Error: it{ Authentication.create_with_omniauth!(nil, nil).should raise_error }
ArgumentError:
ArgumentError
# ./app/models/authentication.rb:13:in `create_with_omniauth!'
# ./spec/models/authentication_spec.rb:69:in `block (5 levels) in <top (required)>'
现在呢?如何测试错误?
【问题讨论】:
标签: ruby-on-rails error-handling rspec