I want to raise an Active Resource exception manually from RSpec and I am trying to doing something like this-
ActiveResource::ResourceInvalid.new(422, "Error Message")
Though I am able to raise ActiveRecord exception but ActiveResource is not raising.
I see the initialize
method of ActiveResource
is expecting two arguments.
def initialize(response, message = nil)
@response = response
@message = message
end
I guess the issue is in sending the response
parameter.
I would try something like this:
Note the
raise
and the curly brackets.