Ask Your Question

"No Rakefile found" when running rspec puppet

asked 2015-05-25 07:21:42 -0600

Chutki gravatar image

updated 2015-05-25 11:48:42 -0600

csharpsteen gravatar image


I have started learning rspec puppet and reffered the below url

and below is my rspec test, all directory I created by the reference url.

|-- testspec
|   |-- classes
|   |   `-- firsttest_spec.rb (**is my sample class test)**
|   |-- defines
|   |-- fixtures
|   |   |-- manifests
|   |   `-- modules
|   |       `-- test
|   |           |-- files -> ../../../../files
|   |           |-- lib -> ../../../../lib
|   |           |-- manifests -> ../../../../manifests
|   |           `-- templates -> ../../../../templates
|   |-- functions
|   |-- hosts
|   `-- spec_helper.rb  **(created this file from reference url 2)**

when i run command "rake testspec" getting below error

rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2376:in `raw_load_rakefile'
(See full trace by running task with --trace

why I am getting this error, am I missing some thing.

This is my first test case in rspec so please help me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-25 10:52:39 -0600

csharpsteen gravatar image

To use rake, you will need to have a Rakefile that defines tasks for the tool to execute somewhere in the current working directory or a parent directory.

RSpec can be invoked directly by: rspec [options] <test directory>. So, the following will run every test case under your testspec directory:

rspec testspec
edit flag offensive delete link more


when I run "rspec testspec" getting "-bash: rspec: command not found", running from /etc/puppetlabs/puppet/module/mymodulename.

Chutki gravatar imageChutki ( 2015-05-26 19:17:22 -0600 )edit

That error suggests that rspec isn't installed or is otherwise not findable. Did you install rspec directly through gem or a system package manager? Or are you using a tool like Bundler?

csharpsteen gravatar imagecsharpsteen ( 2015-05-26 21:57:06 -0600 )edit

when I run " gem list" showed rspec package (already installed in the server) then I followed the instruction from url (check my initial post)

Chutki gravatar imageChutki ( 2015-05-26 22:37:55 -0600 )edit

My rake version is (0.8.7) and rspec-puppet version is (1.0.1), also don't see any content on .fixtures.yml

Chutki gravatar imageChutki ( 2015-05-27 06:08:41 -0600 )edit

Gem could be installing the command line tools to a directory that isn't on the default PATH. I think this happens on CentOS at least. The `gem env` should print out a "EXECUTABLE DIRECTORY", is that on your PATH?

csharpsteen gravatar imagecsharpsteen ( 2015-05-29 14:53:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-05-25 07:21:42 -0600

Seen: 756 times

Last updated: May 25 '15