Running the Test
Learn how to run tests on rails application and workflow of running RSpec example group.
We'll cover the following...
Gatherer app’s first test
Now that we’ve written our first test, we’d probably like to execute it. Although RSpec provides Rake tasks for executing RSpec, use the rspec
command directly to avoid the overhead of starting up Rake. If we use rspec
with no arguments, RSpec will run over the entire directory. See Running Tests Faster and Running Faster Tests for details on those options.
What happens when the test is run?
It fails. We haven’t written any code yet.
What really happens—internally?
When we run rspec
with no arguments, RSpec loads every file in the spec
directory. The following things happen (this process is slightly simplified for clarity):
-
Each file in the
spec
...