RSpec says there are no Tests in a Non-Empty Test Case

RSpec says there are no Tests in a Non-Empty Test Case

Last updated:

Sometimes when you create a test case using escaped single quotes (for example,'there\'s no place like home') it will mistakenly think there's no test cases.

This example works ok.

it 'runs correctly' do
    # your expectations
end

This one works as well:

it "doesn't throw exceptions when given bad data" do
    # your expectations 
do

While this one doesn't:

it 'runs correctly when there\'s no exceptions' do
    # your expectations
end

Moral of the story: use double quotes to define your test cases when running RSpec.

P.S.: I'm running Ruby 2.0.0-p247 from RVM and RSpec version 2.14.1.