Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Document how to test #171

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,51 @@ end
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Testing

### General: Which Ruby

Check that the Ruby version you are running is one that is supported.
You can see what versions RSpec is tested against by looking at the
[.travis.yml](https://github.com/rspec/rspec-support/blob/v3.2.1/.travis.yml#L16-26)
(noting [allowed failures](https://github.com/rspec/rspec-support/blob/master/.travis.yml#L34-L36))
and the [appveyor.yml](https://github.com/rspec/rspec-support/blob/v3.2.1/appveyor.yml#L32-L34).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We support > 1.8.7 basically...


### Running tests

`bundle exec rake` locally, and check the CI results in your pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see that a place for this yet exists on http://rspec.info/contributing/. If something like this text is ok, I would make a PR to add it to the page and link to it from here.

### Caveats: Encodings

Some tests fail if the external/locale/filesystem encoding is ISO-8859-1, which is the default on
some machines, such as the [rake-compiler-dev-box](https://github.com/tjschuck/rake-compiler-dev-box).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still like to just not mention this...


The tests on Travis run with certain [ENV variables our suite depends on](http://docs.travis-ci.com/user/ci-environment/):

> LANG=en_US.UTF-8
> LC_ALL=en_US.UTF-8
> JRUBY_OPTS="--server -Dcext.enabled=false -Xcompile.invokedynamic=false"

**Ruby 1.9+ on *nix** uses `LANG`, `LC_ALL` among other variables to set the Encoding.default_external.
The settings above will set it to UTF-8. Thus, before running tests, you'll want to ensure you or your
login profile have run

```bash
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
```

**Ruby 1.9+ on Windows** likely runs under an Encoding.default_external such as `ibm437`.
You can get the current `codepage` from the command prompt by running `chcp` and
change it to utf8 via `chcp 65001`. See
https://github.com/rspec/rspec-support/pull/151#discussion_r22991439
http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using and
https://github.com/ruby/ruby/blob/9fd7afefd04134c98abe594154a527c6cfe2123b/ext/win32ole/win32ole.c#L540
for more information and https://github.com/rspec/rspec-support/pull/151#discussion_r22991439 for
background discussion.

The above platform-specific methods are necessary when running our tests on Ruby 1.8.7. Otherwise,
we could run our tests commands with `ruby -E UTF-8:UTF-8 -S $spec_command`, which fails on Ruby 1.8.7.

Available **JRUBY** options can be reviewed by running `jruby --properties`.