Hello guys,
I was just starting a rails 3.0.5 application with rspec-rails 2.5.0
and ruby 1.9.2-p180 and when I went to describe my controller I ran
into this undefined method ‘get’ error.
Here’s the spec that is causing the problem (which lives in the folder
spec/controllers)
require ‘spec_helper’
describe ArticlesController, :type => :controller do
describe “GET index” do
get :index
response.should be_successful
end
end
And here’s the error it throws:
spec/controllers/articles_controller_spec.rb:13:in block (2 levels) in <top (required)>': undefined method
get’ for #<Class:
0x00000104799aa0> (NoMethodError)
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/example_group.rb:132:in module_eval' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/example_group.rb:132:in
subclass’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/example_group.rb:119:in describe' from /spec/controllers/articles_controller_spec.rb:12:in
block in
<top (required)>’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/example_group.rb:132:in module_eval' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/example_group.rb:132:in
subclass’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/example_group.rb:119:in describe' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/extensions/object.rb:6:in
describe’
from /spec/controllers/articles_controller_spec.rb:3:in <top (required)>' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/configuration.rb:386:in
load’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/configuration.rb:386:in block in load_spec_files' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/configuration.rb:386:in
map’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/configuration.rb:386:in load_spec_files' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/command_line.rb:18:in
run’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/runner.rb:55:in run_in_process' from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/ rspec/core/runner.rb:46:in
run’
from /Users/DBA/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.1/lib/
rspec/core/runner.rb:10:in `block in autorun’
What could be causing rspec not to find controller example group
methods?
Best regards,
DBA