Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dupe doesn't raise ActiveResource::ResourceNotFound? #11

Open
nzifnab opened this issue Apr 8, 2010 · 1 comment
Open

Dupe doesn't raise ActiveResource::ResourceNotFound? #11

nzifnab opened this issue Apr 8, 2010 · 1 comment

Comments

@nzifnab
Copy link

nzifnab commented Apr 8, 2010

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

@moonmaster9000
Copy link
Owner

i think you're right, i should just raise ActiveResource::ResourceNotFound errors instead of the Dupe version of them... adding it to the list!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants