Failing to run RSpec (uninitialized constant User (NameError) - ruby

Trying to run bundle exec rspec spec/models/user_spec.rb but failing to execute (see error below).
Contents of user_spec.rb:
require 'rails_helper'
describe User do
pending "add some examples to (or delete) #{__FILE__}"
end
If I remove the last 3 lines, then it complete with 0 examples and 0 failures. However, when the last 3 lines are present, it generates an error
/spec/models/user_spec.rb:4:in `<top (required)>': uninitialized constant User (NameError)
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `block in load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `each'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:in `setup'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in `invoke'
from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec:4:in `<top (required)>'
from /usr/local/bin/rspec:23:in `load'
from /usr/local/bin/rspec:23:in `<main>'
It seems it doesn't know what User is and treats it as a constant, when this is infact a model. I have verified in the ruby sandbox that I can create new Users in the database. Any ideas?
Answer:
After removing --warnings from .rspec (thank you kirti), current error was about capybara version being too low (requires 2.2). After installing the latest version (modifying gemfile and bundle install), rspec appears to be executing correctly. Thank you to all for your comments.

I had the same issue, this was due to rspec/rails_helper.rb not being called anywhere.
I added it to the .rspec file, so my file look like this
--color
--require spec_helper
--require rails_helper
This and adding warnings to false in the spec/spec_helper.rb solved it for me !
config.warnings = false

After removing --warnings from .rspec (thank you kirti), current error was about capybara version being too low (requires 2.2). After installing the latest version (modifying gemfile and bundle install), rspec appears to be executing correctly. Thank you to all for your comments.

For me, the issue was that the name of the class was not being correctly called due to it being in another namespace. For example, I had:
RSpec.describe User do
# ... some tests
end
where I should have had
RSpec.describe MyModule::User do
# ... some tests
end
because the user class was defined with the MyModule module.

Related

Running a single RSpec spec fails with "`require': cannot load such file"

I am trying to get test-first-ruby-master as instructed but I am getting multiple errors. This is the structure of the files/directory in test-first-ruby-master:
Gemfile Gemfile.lock README.md lib spec
lib contains ruby files and spec contains spec files.
I am trying to execute 00_hello_spec.rb file on my terminal but it doesn't work.
What I have tried
require "lib/00_hello.rb"
require_relative "lib/00_hello.rb"
Errors I get
supritkumars-MacBook-Pro:test-first-ruby-master supritkumarshah$ rspec spec/00_hello_spec.rb
/Users/supritkumarshah/Desktop/test-first-ruby-master/spec/00_hello_spec.rb:103:in `require': cannot load such file -- lib/00_hello.rb (LoadError)
from /Users/supritkumarshah/Desktop/test-first-ruby-master/spec/00_hello_spec.rb:103:in `<top (required)>'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `load'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `<main>'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/supritkumarshah/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Thank you
The require is failing because you're requiring a relative path, 'lib/00_hello.rb', but the directory it's relative to (the root of your project) is not in the list of directories that Ruby is looking in for files to require (the load path, $LOAD_PATH).
There are lots of ways to fix this. Here are some:
Tell rspec to add the root of your project to the load path. Since that's your current directory, you can use .:
rspec -I. spec/00_hello_spec.rb
Change your spec to require_relative '../lib/00_hello'. This works regardless of the current directory or load path — a good idea in command-line programs, although not so important for a learning project.
As B Seven answered, change your spec to require './lib/00_hello'. This requires you to run rspec in the root of your project.
You can even remove the require altogether! When you run rspec, if the current directory has subdirectories named lib and/or spec, rspec adds them to the load path. This also requires you to run rspec in the root of your project. This solution won't work if you need the require when running your program for real (not under rspec).
Note that including the .rb in the filename you required did not cause the problem, but it's not necessary.
Although Dave's answer is correct, I prefer to use:
require './lib/00_hello'
Did you tried adding require 'bundler/setup' at the top of your test helper file?

Why does rake_test_loader.rb fail (LoadError) when tests run in Rake under RVM ruby version 2.2.1

I have just started to use RVM and have installed ruby version 2.2.1. I have a test project whose Rake test task I was successfully executing tests with the system version (2.0.0). When I then switch to 2.2.1 via RVM, the rake_test_loader fails with a LoadError.
As far I can see, there following are possible culprits
different version of Ruby in use
RVM environment is causing a problem
there is a problem with RVM and Rake
My code is packaged into standard gem structure. The rake file is as follows:
($LOAD_PATH << File.expand_path("../lib", __FILE__)).uniq!
require 'rake/testtask'
require 'rdoc/task'
require 'rubygems/package_task'
# Run All Tests Task
#
Rake::TestTask.new('test') do |t|
t.pattern = 'test/**/*tests.rb'
t.warning = true
end
task "default" => ["test"]
The exact error (with --trace flag set) is as follows:
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- test/unit (LoadError) from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from
/Users/Sancho/dev/git/joy/test/expression/core_staging_gallery_name_regexp_tests.rb:1:in
<top (required)>' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb:10:in
block (2 levels) in ' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb:9:in
each' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb:9:in
block in ' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb:4:in
select' from
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb:4:in
' rake aborted! Command failed with status (1): [ruby -w
-I"lib" "/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_test_loader.rb"
"test/**/*tests.rb" ]
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/testtask.rb:108:in
block (3 levels) in define'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils.rb:57:in
call'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils.rb:57:in
sh'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils_ext.rb:37:in
sh'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils.rb:96:in
ruby'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils_ext.rb:37:in
ruby'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/testtask.rb:104:in
block (2 levels) in define'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/file_utils_ext.rb:58:in
verbose'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/testtask.rb:100:in
block in define'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:240:in
call'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:240:in
block in execute'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:235:in
each'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:235:in
execute'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:179:in
block in invoke_with_call_chain'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in
mon_synchronize'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:172:in
invoke_with_call_chain'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/task.rb:165:in
invoke'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:150:in
invoke_task'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:106:in
block (2 levels) in top_level'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:106:in
each'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:106:in
block in top_level'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:115:in
run_with_threads'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:100:in
top_level'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:78:in
block in run'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:176:in
standard_exception_handling'
/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:75:in
run' /Users/Sancho/.rvm/rubies/ruby-2.2.1/bin/rake:33:in `'
Tasks: TOP => test
I am not sure if the above trace is that helpful, so I displayed the $LOAD_PATH when the tests are run under system ruby version 2.0.0 and RVM ruby version 2.2.1
$LOAD_PATH when tests fail under RVM ruby version 2.2.1:
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/dev/git/joy/lib"
$LOAD_PATH when tests pass under 2.0.0:
"/Library/Ruby/Site/2.0.0",
"/Library/Ruby/Site/2.0.0/x86_64-darwin13",
"/Library/Ruby/Site/2.0.0/universal-darwin13",
"/Library/Ruby/Site",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13",
"/Users/Sancho/dev/git/joy/lib"
The root of the project is /Users/Sancho/dev/git/joy/
Tests are located at /Users/Sancho/dev/git/joy/test/.../*_tests.rb
Code under test located at /Users/Sancho/dev/git/joy/lib/joy/.../*.rb
So to summarise, the same code (invoked by rake test task) is being executed in both scenarios, 1 passes the other fails. The first scenario is using the system version of ruby (version 2.0.0, passes) and the second scenario is RVM ruby version 2.2.1 (fails).
So, what's causing the LoadError problem?
Thanks.
UPDATE:
I have installed version 2.0.0p598 via RVM (as opposed to the system version 2.0.0p481. (I had to use p598 because p481 is no longer available).
Using version 2.0.0p598, the tests worked fine. This rules out RVM in itself being a problem and leads me to believe there is an issue with the latest version of ruby 2.2.1. Can anyone shed any light on this?
UPDATE No 2:
Ruby version 2.1.1p76 also works.

Error when trying to run RSPEC. Why?

I can't figure out why my RSPEC isn't working. I reinstalled RSPEC with sudo gem install rspec and then tried again to install with a specific version number (sudo gem install rspec -v 2.11.0)
I continue to get the following error message and I cannot figure out what it means. I believe that I may or may not have version 1 also installed, not sure.
Castillo$ rspec document_spec.rb
/Users/Castillo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require': no such file to load -- document (LoadError) from
/Users/Castillo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require' from /Users/Castillo/Desktop/document_spec.rb:1:in <top
(required)>' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inload' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in block in load_spec_files' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inmap' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in load_spec_files' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:inrun' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in
run' from
/Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in
block in autorun'
Add full path to your document.rb file into spec file
or use
require_relative
or
require File.expand_path('../document.rb', __FILE__)

Run kaminari specs

this is probably a stupid question but I can't seem to find the answer.
I'd like to contribute to kaminari, so I forked the repo, bundle'd it, and now I would like to run the specs to ensure all's green. But I can't seem to make it work :
bin/rake spec
/Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/bin/ruby -S rspec spec/config/config_spec.rb spec/helpers/action_view_extension_spec.rb spec/helpers/helpers_spec.rb spec/helpers/sinatra_helpers_spec.rb spec/helpers/tags_spec.rb spec/models/active_record/active_record_relation_methods_spec.rb spec/models/active_record/default_per_page_spec.rb spec/models/active_record/scopes_spec.rb spec/models/array_spec.rb spec/models/data_mapper/data_mapper_spec.rb spec/models/mongo_mapper/mongo_mapper_spec.rb spec/models/mongoid/mongoid_spec.rb spec/requests/users_spec.rb
warning: no framework detected.
would you check out if your Gemfile appropriately configured?
---- e.g. ----
when Rails:
gem 'kaminari'
when Sinatra/Padrino:
gem 'kaminari', :require => 'kaminari/sinatra'
when Grape:
gem 'kaminari', :require => 'kaminari/grape'
/Users/Ksoltysiak/Documents/Repositories/kaminari/spec/models/array_spec.rb:3:in `<top (required)>': uninitialized constant Kaminari::PaginatableArray (NameError)
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `map'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
/Users/Ksoltysiak/.rbenv/versions/1.9.3-p125/bin/ruby -S rspec spec/config/config_spec.rb spec/helpers/action_view_extension_spec.rb spec/helpers/helpers_spec.rb spec/helpers/sinatra_helpers_spec.rb spec/helpers/tags_spec.rb spec/models/active_record/active_record_relation_methods_spec.rb spec/models/active_record/default_per_page_spec.rb spec/models/active_record/scopes_spec.rb spec/models/array_spec.rb spec/models/data_mapper/data_mapper_spec.rb spec/models/mongo_mapper/mongo_mapper_spec.rb spec/models/mongoid/mongoid_spec.rb spec/requests/users_spec.rb failed
I tried to bypass bundler, but then I got gems issues with versions and stuff. So what am I missing here ? I don't find anything on the wiki or the issues, or even here about this.
Thanks for your time!
I recently made series of changes on Kaminari tests. https://github.com/amatsuda/kaminari/compare/b61db76...1f8389ae
As a result of this big refactoring, now the tests can be run separately per each ORM library, for example like this:
BUNDLE_GEMFILE=gemfiles/active_record_32.gemfile bundle exec rake spec
To run all tests at once, you should invoke spec:all task:
bundle exec rake spec:all
I'm aware that this is a bit unusual. At least it apparently needs to be documented. I'll do so till the next stable release.
Or if you have any better solution, please tell me.

Ruby on Rails rspec bug?

every time i execute rspec, dosen't matter what I have done, if the code is wrong it tells:
nev3rkill#nev3rkill-virtual-machine ~/Documentos/ruby $ rspec
/home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load': no such file to load -- /home/nev3rkill/Documentos/ruby/spec (LoadError)
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
nev3rkill#nev3rkill-virtual-machine ~/Documentos/ruby $
I have tested with a lot of versions, with ruby 1.9.3,1.9.2 but i don't know. Is it normal?
Unless you're in a path with a spec directory (e.g. the root of your rails project), you also need to tell rspec which spec files to run, either by passing it a directory or file. e.g:
$ rspec path/to/specs/
Will run all the specs in the path/to/specs/ path (recursively), or:
$ rspec spec/your_specs.rb
will run the specs in the spec/your_specs.rb file.

Resources