We'd love for you to contribute back to our tutorial series making it even better. The following are the guidelines we'd appreciate that you follow. Don't forget to have fun learning!
This guided tutorial is an attempt to introduce newer developers to strong testing practices while using RSpec. The tutorial is designed to introduce various features of the RSpec 3 testing tool in an manner which is:
- approachable; tutorials are easy to follow and progress through
- manageable; RSpec features are introduced gradually in a manner which progressively improves on prior explained features and topics
- promoting of what we consider strong testing practices
This tutorial series is primarily intended for developers new to both testing and RSpec. Even though that is our initial target audience, any developer using RSpec can still derive benefit from the content.
Help us keep this learning tutorial open and inclusive. Read and follow our code of conduct.
This is a new project. We are just getting off the ground.
We're really rather friendly! Here are the best places to talk about the project:
- Start an issue on GitHub
- Try to find us on IRC, we tend to hang out in
#rspecon Freenode - Contact us on Twitter:
- Aaron Kromer (@cupakromer)
If you have a suggestion for a topic, or something you wish for us to cover,
please open an
issue on GitHub.
Feel free to apply the topic label when submitting. Before submitting your
topic idea search the archive, we may have already discussed it.
When submitting topic suggestions, we'd appreciate it if you would include the following:
- Short detailed description of the topic (not just the name of an RSpec DSL method or general testing topic)
- A more detailed explanation stating the desired learning goal for the topic tutorial; feel free to include multiple learning goals which may be broken across tutorials
- Any example code you may have in mind to demonstrate
Since topics tend to be fairly major changes, we appreciate you opening an issue first, before spending time writing up the content. We ask this so that we can properly coordinate how the topic should fit into the existing tutorial series.
All submissions which include code samples or reference code must work with Ruby 2.1.0 or newer. As well as, RSpec 3.0.0.beta1 or newer.
- Ruby >= 2.1.0
- RSpec >= 3.0.0.beta1
You've got something you want to contribute back. Huge thank you!
Our general steps for contributing back to the project are:
-
Search GitHub for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort.
-
Fork the repo.
-
Create a feature branch (
git checkout -b my-new-feature) -
Run the specs. We only take pull requests with passing specs, and it's great to know that you have a clean slate:
bundle && rspec -
Add your content. This includes: - Associated tutorial - Relevant code - Specs for all code changes; only refactoring and documentation changes require no new specs
-
Verify you've adhered to our coding style guide
-
Commit your changes with a descriptive commit message; check our tips for creating good commit messages
-
Push the branch to your fork (
git push origin my-new-feature) -
Create new Pull Request
We'll do our best to comment on all pull requests in a timely manner. When we leave a comment, we may make some suggestions, changes, and/or improvements. It is possible we may also leave other general feedback on how we feel the request fits in with the rest of the project goals.
-
Two space indents, no tabs
-
No trailing whitespace
-
Blank lines should not have any other whitespace
-
Prefer
&&/||overand/or -
Use parenthesis, without whitespace, for method definitions which take arguments:
- Bad:
def do_something with_object - Bad:
def do_something( with_object ) - Good:
def do_something(with_object)
- Bad:
-
When sending messages, always use parenthesis if the return value is meaningful and an argument is passed, parenthesis should not contain buffer whitespace:
- Bad:
tmp = a_string.gsub /test/, "check" - Bad:
tmp = a_string.gsub( /test/, "check" ) - Good:
tmp = a_string.gsub(/test/, "check") - Good:
tmp = a_string.upcase - OK - Non-meaningful return:
a_string.gsub! /test/, "check"
- Bad:
-
When using blocks:
-
Always use the bracket
{...}style for meaningful return values; do not separate the message and left bracket{with whitespace:# Bad - Whitespace after `select` evens = numbers.select { |num| num.even? } # Good evens = numbers.select{ |num| num.even? } sum_of_squares = evens.reduce(0){ |sum, num| sum + (num * num) }
-
Always use the
do...endstyle for non-meaningful return values:commands.each do |command| puts "Calling #{command}" command.call end
-
Do not use the bracket
{...}style for non-meaningful one liners; use thedo...endstyle spread across multiple lines:# Bad numbers.each{ |num| puts num } # Good numbers.each do |num| puts num end
-
-
Put whitespace around assignments:
a = band nota=b -
Follow any additional conventions you see used in the source already
For any git project, some good rules for commit messages are:
- the first line is commit summary, 50 characters or less
- followed by an empty line
- followed by an explanation of the commit, wrapped to 72 characters
For more on commit messages see:
That's it! Again, big thank you for your contribution! ❤️
While the patch is being reviewed, we may ask that you make additional changes. We'll provide further guidance at this point on a case-by-case basis. We'll use the Pull Request for all additional communications.
After the patch has been merged, it is safe for you to delete your associated feature branch. Please don't delete the branch before we've merged, or closed, the Pull Request. It will make submitting any necessary changes easier for you and us.
Additionally, after we've merged the patch, you can then pull down the changes from the main upstream repository:
-
Delete your remote feature branch on Github:
git push origin --delete my-fix-branch
-
Check out your local master branch:
git checkout master -f
-
Delete your local feature branch:
git branch -D my-fix-branch
-
Update your master with the latest upstream version:
git pull --ff upstream master