dupe
dupe copied to clipboard
Dupe doesn't raise ActiveResource::ResourceNotFound?
I'm getting this error:
Dupe::Network::Mock::ResourceNotFoundError in 'User#find_by_id should return nil if the id is not correct'
Failed with 404: the request '/v1/users/202.xml' returned nil.
But my code in the model looks like this:
def self.find_by_id(user_id)
find(user_id)
rescue ActiveResource::ResourceNotFound
nil
end
I find it odd that Dupe doesn't throw up ActiveResource::ResourceNotFound
errors since that's what one would be rescuing in the code. My spec doesn't work because the error is being raised, even though I'm rescuing the real-world exception.:
it "should return nil if the id is not correct" do
User.find_by_id(@user.id + 200).should be_nil
end
Sorry if it feels like I'm being nitpicky with dupe! I reaaaally love dupe :) It's great and does just about everything I need. But there are these couple things I feel it's missing to be really stellar
i think you're right, i should just raise ActiveResource::ResourceNotFound errors instead of the Dupe version of them... adding it to the list!