[rspec-users] rspec - undefined method `describe' for main:Object

Scott Taylor mailing_lists at railsnewbie.com
Fri Oct 10 09:46:08 EDT 2008


On Oct 10, 2008, at 2:56 AM, Mano ah wrote:

>
>
> When i run a spec file i am getting the following error
>
>  D:\Diwakar\spec_diwa\spec\controllers>spec sandbox_controller_spec.rb
>
> c:/ruby/lib/ruby/gems/1.8/gems/rspec-0.5.15/lib/spec/api/sugar.rb: 
> 17:in
> `method_
> missing': undefined method `describe' for main:Object (NoMethodError)
>        from ./sandbox_controller_spec.rb:7
>        from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:28:in `ge
> m_original_require'
>        from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:28:in `re
> quire'
>        from c:/ruby/lib/ruby/gems/1.8/gems/rspec-0.5.15/bin/spec:13
>        from c:/ruby/lib/ruby/gems/1.8/gems/rspec-0.5.15/bin/spec:7:in
> `each'
>        from c:/ruby/lib/ruby/gems/1.8/gems/rspec-0.5.15/bin/spec:7
>        from c:/ruby/bin/spec:19:in `load'
>        from c:/ruby/bin/spec:19
>
>
>
> My spec controller is
>
> require File.dirname(__FILE__) + '/../spec_helper'

What's in this file?

>
> #require './../../vendor/generators/rspec/lib/rspec_on_rails'

You wont' need this.

>
> #require 'sandbox_controller.rb'

You won't need this one, either

>
> require 'spec'

Nor this

>
> gem 'rspec'

Nor this.

>
>
> describe SandboxController,"handling someaction" do
>
>  it "should get real value 10" do
>
>    get :someaction
>
>    assigns[:value].should equal(10)
>
>  end
>
> end
>
>
>
> My controller is
>


Why do you have a controller already?

Scott


More information about the rspec-users mailing list