我写了一个测试,我希望结果会引发错误。
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)>'
怎么办?你如何测试错误?