Question: I'm trying to run a simple `test\spec` but getting an error. Error is only happening when the tests fail. 

```
begin
  require 'rubygems'
  require 'test/spec'
rescue LoadError
  puts "==> you need test/spec to run tests. {sudo gem install test-spec}"
end

context "Foo" do 
  specify "should bar" do 
    "ttes".should.equal "tes"
  end
end

```

> 
> 1) Error: test\_spec {Foo} 001 should bar: NoMethodError:
>  undefined method `ascii_compatible?' for #<Encoding:US-ASCII>
>  person.rb:11:in`block (2 levels) in '
> 
> 
>

Answer: 
I can only guess, but there is something very strange going on here. Are you mixing Ruby versions or something? Are you using a gem that's not compatible with your version of Ruby? Every encoding instance should respond to [`ascii_compatible?`](http://apidock.com/ruby/Encoding/ascii_compatible%3F) in Ruby 1.9, so maybe you are using 1.8 (as you seem to be on Windows, this seems likely).

Also, a full stack trace will be of great help (you can catch the exception with `begin`/`rescue` and call [`backtrace`](http://apidock.com/ruby/Exception/backtrace) on it. That way you will find out which exact line of the `test-spec` module fails.

Also, *test-spec* doesn't seem to be a very actively developed Gem. Maybe an option is to use [*RSpec*](https://www.relishapp.com/rspec) instead, a more widely used tool with the same purpose.
I was getting a similar problem running Ruby 1.9.1 on Windows. My environment had been previously set up to run Ruby for some scripting of automated tests for embedded development.

I tried installing 1.9.3, but the problem was still there. Eventually uninstalled both 1.9.1 and 1.9.3, re-installed Ruby 1.9.3 and test-unit gem (2.4.5) and everything works OK now.