Testing#182
Conversation
There was a problem hiding this comment.
the indention here is a bit wild - looks like 8 spaces. Or do you use tabs?
It's recommended and encouraged to use two spaces white space (non tab) indention in Ruby. Whitespaces are preferred over tabs because when someone has different tab settings code just starts to look weird, especially if whitespaces and tabs are mixed.
Would be glad if you could fix that up :-)
|
Indentation fixed! :) |
There was a problem hiding this comment.
Using describe&it with parentheses is highly unusual - it's better style to leave the parentheses out here - I think I've never seen it with them... e.g. describe '#index' do etc.
|
Thanks! Left you another small remark! =) |
There was a problem hiding this comment.
For consistency and update reasons you could migrate this to the expect syntax as well, e.g. expect(response).to redirect_to(root_path) should work :)
There was a problem hiding this comment.
When it is better to use expect syntax?
Thanks for the feedback!
There was a problem hiding this comment.
Well expect is the new default for RSpec 3.0+ (and maybe even 2.14). So it is generally encouraged, the old syntax will still be maintained but expect is generally the way to go (among other things with expect you don't need to have monkey patching). Also it helps in some edge cases, see this: http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
Fixed! Repeating my question: when it is recommended "expect" syntax instead of "should" syntax? |
|
Thanks for your work on testing! =) And glad to give feedback, least I can do :-) Little answer on expect vs. should in the comment. Some thoughts about expect vs. should from another project: shoes/shoes4#479 |
Added some user controller specs