Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec and Autotest issue in rails 3 project

Im using autotest-notification v2.3.4 and rspec v2.0.1 for writing tests in my rails v3.2.3 project on my machine running Ubuntu 12.04.In my pages_controller_spec.rb i have the following code

require 'spec_helper'

describe PagesController do

   describe "GET 'contact'" do
    it "should be successful" do
      get 'contact'
      response.should be_success
    end
  end

end

When i run the command rspec spec/ im getting the following error

DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::SetupAndTeardownAdapter instead. (called from <top (required)> at /home/kris/development/rails_projects/s\
ample_app/spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::TestUnitAssertionAdapter instead. (called from <top (required)> at /home/kris/development/rails_projects/\
sample_app/spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::ViewRendering instead. (called from <top (required)> at /home/kris/development/rails_projects/sample_app/\
spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::ControllerExampleGroup instead. (called from <top (required)> at /home/kris/development/rails_projects/sa\
mple_app/spec/controllers/pages_controller_spec.rb:3)

Failures:
  1) PagesController GET 'contact' should be successful
     Failure/Error: Unable to find matching line from backtrace
     undefined method `run_all' for []:Array
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/hooks.rb:116:in `run_hook_filtered'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:174:in `eval_before_alls'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:229:in `run'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block (2 levels) in run'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `map'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block in run'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/reporter.rb:11:in `report'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:23:in `run'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:55:in `run_in_process'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:46:in `run'
     # /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:10:in `block in autorun'

Finished in 0.00028 seconds
1 example, 1 failure
/home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/hooks.rb:116:in `run_hook_filtered': undefined method `run_all' for\
 []:Array (NoMethodError)
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:213:in `eval_after_alls'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:236:in `run'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block (2 levels) in run'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `map'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block in run'

What is causing this error and how can i fix it ?

Please Help Thank You.

like image 390
Kris Avatar asked Dec 27 '22 00:12

Kris


1 Answers

Try updating RSpec. This: ruby-forum.com/topic/788351 (and the linked github issue) suggests there is an issue with older versions of RSpec, and Ruby 1.9.3.

like image 176
Sam Peacey Avatar answered Jan 13 '23 11:01

Sam Peacey