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

as_new_record not working? #22

Closed
jbpros opened this issue Apr 8, 2010 · 6 comments
Closed

as_new_record not working? #22

jbpros opened this issue Apr 8, 2010 · 6 comments

Comments

@jbpros
Copy link

jbpros commented Apr 8, 2010

Hi!

post = mock_model(Post).as_new_record
post.new_record?.should be_true # fails

Is it implemented yet?

@dchelimsky
Copy link
Contributor

Yes: http://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/mocks.rb#L23

Not sure why it's not working - is that really all the code you've got?

@jbpros
Copy link
Author

jbpros commented Apr 9, 2010

Sorry I was a bit in a rush yesterday.

post = mock_model(Post).as_new_record
post.new_record? # returns false instead of true. 

I have not much more to report.

I also noticed that form_for expects #to_key to return something and mock_model does not seem to take care of that. But that's another problem.

@dchelimsky
Copy link
Contributor

That's what I get for copying over the rspec-1 code without the specs! Turns out to be a bug that was recently introduced in rspec-mocks. Will be fixed before the next beta release (soon).

@dchelimsky
Copy link
Contributor

OK - the as_new_record issue is fixed in rspec-mocks and will be part of the beta.6 release. I'll add a separate issue for #to_key. Separate issues should be documented in separate issues.

@jbpros
Copy link
Author

jbpros commented Apr 9, 2010

Thank you very much. Sorry for the separate issue. I'll be more careful next time :)

@dchelimsky
Copy link
Contributor

I appreciate it - makes it less likely for things to fall off the radar.

This issue was closed.
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