Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec NoMethodError: "undefined method `describe' for main Object"

Tags:

ruby

rspec

I am trying to learn Rspec. My ruby project in eclipse is as follows -

enter image description here

The code-

require 'rspec' require './RubyOffRailsTuts/classes/furlong'  describe Furlong do end 

The error-

/RubyOffRailsTuts/specs/furlong_spec.rb:6:in `<main>': undefined  method `describe' for main:Object (NoMethodError) 

Did not get any useful answers online. How do I fix this problem ?

like image 886
Erran Morad Avatar asked Nov 18 '14 05:11

Erran Morad


1 Answers

Alternative to prefacing describe as RSpec.describe, you can add

config.expose_dsl_globally = true 

to your spec_helper.rb.

like image 178
0xtobit Avatar answered Sep 29 '22 13:09

0xtobit