erikhuda/thor — pull request #392 by TimMoore (2013-12-27 04:04:51+00:00)
Title: Specify an explicit external encoding for tests

On my system, I have set my `LC_ALL` environment variable to `C`, because it speeds up a lot of common Unix commands when you're dealing with ASCII-only input.

This causes Ruby to use `US-ASCII` as the default external encoding, which triggers a failure in the Thor specs:

```
Failures:

1) Thor::Shell::Basic#print_table uses maximum terminal width
Failure/Error: expect(content).to eq(<<-TABLE)
ArgumentError:
invalid byte sequence in US-ASCII
# ./spec/shell/basic_spec.rb:208:in `block (3 levels) in '
```

Changing `Encoding.default_external` globally in the spec helper is the most straightforward fix, but there are a lot of other possible ways to fix this, particularly by specifying an explicit encoding for the `StringIO` object created in the `capture` helper. Let me know if you'd like me to resubmit with a different solution.