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

Proposing some test style standards #12

Open
jphenow opened this issue Feb 18, 2014 · 6 comments
Open

Proposing some test style standards #12

jphenow opened this issue Feb 18, 2014 · 6 comments

Comments

@jphenow
Copy link

jphenow commented Feb 18, 2014

We've proven, by having and using this style guide, that we all have at least some amount of respect for achieving a reasonable level of consistency amongst our code. It creates less confusion, makes jumping into code and understand what's happening much less of a chore, not to mention how much easier various editor tasks are if we can at least hope for that code consistency. All of that said, I'd like to propose we apply the style guide towards our testing consistency as well.

For RSpec context and describe are aliases. While I understand there is a difference in reading context vs. reading describe, its the same argument between map and collect. They both do the same thing, we know they do the same thing, and we confuse the use of the two. Perhaps though, that difference can expose some test meaning - I think that argument is worth settling in the style guide. This is one example of a style detail that I would like to put down for future and enforce a standard.

I would be in favor of writing a guide for both TestUnit and RSpec such that we can continue to aim towards reasonable consistency in our development efforts. There currently are not many (of any) TestUnit style guides in the community (does that say something?), but I think some simple standards could be set, especially if we're to continue using it on newer applications.

Existing links to check out:

@chrisarcand
Copy link
Contributor

👍

@NickLaMuro
Copy link

I think if we are going to refer to class methods, we should use the :: syntax, and not the .. Ruby docs use the ::, and I think it is a little more obvious on what is being referred to when using that syntax.

@NickLaMuro
Copy link

I really wish that rspec didn't remove before(:all), because it makes doing controller tests in a reasonable fashion (with multiple assertions) really difficult.

@jphenow
Copy link
Author

jphenow commented Feb 18, 2014

I see your reasoning with :: and I like it with the more-explicative nature. Keep in mind this removal is coming in the future.

before(:all) does still exist does it not?

@carlallen
Copy link
Contributor

Do this...

@anfleene
Copy link
Contributor

This will be a bit complicated since we'll have rspec 2, rspec 3, and minitest. But I totally think its worth it. I've already started using rspec 3 on some projects and its pretty sweet.

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

5 participants