Jithin Jacob
Jithin Jacob

Reputation: 1

Trying to understand the error

I was learning about the gem Rspec through a tutorial when this error came up.The last thing I typed in was

$ rspec spec spec\hello_world_spec.rb

I had only installed the Rspec gem and nothing else.

the output message from the cmd

Upvotes: 0

Views: 38

Answers (2)

Glyoko
Glyoko

Reputation: 2090

You're passing spec and spec\hello_world_spec.rb as arguments to rspec. These are interpreted as files to run, or directories to search through for files to run. Since you're already running in the spec\ directory, rspec is looking for spec\spec\ and spec\spec\hello_world_spec.rb, which don't exist. Try running that from one directory up (in a typical ruby project, the "root" of your project) and it should run.

i.e. Instead of:

\rspec_tutorial\spec>rspec spec spec\hello_world_spec.rb

try:

\rspec_tutorial>rspec spec spec\hello_world_spec.rb

Also, as @Ursus points out, running rspec spec spec\hello_world_spec.rb is redundant. Rspec will search through spec\ for files to run and will run hello_world_spec.rb automatically since it's under spec. If you only want to run hello_world_spec.rb–which seems to be your intent–then drop the spec from the command, per @Ursus' answer.

Upvotes: 0

Ursus
Ursus

Reputation: 30056

Try to get rid of spec

rspec spec\hello_world_spec.rb

Upvotes: 2

Related Questions