Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

ruby method describe <nomethoderror>

I am trying to run a practice exercise in ruby.

require_relative "hello"

describe "the hello function" do it "says hello" do hello.should == "Hello!" end end

the program I believe is to test out RSpec and walks through several errors.

Unfortunately I am getting an error I'm not suppose to get. It is saying that there is a no method error for describe. I have tried to reinstall rspec and I have tried to google the error and have found nothing. I have also tried to use the describe method in IRB but I get the same error.

If there something I need to do to teach my computer the method describe?

1 Answer

If you are using a recent version of RSpec, the describe method is to be called from the RSpec module:

require_relative 'hello'

RSpec.describe 'my hello function' do
  it "says hello" do
    expect(hello).to eql("Hello!")
  end
end

Note that you must have the rspec gem installed (gem install rspec). Then issue:

$ rspec hello_spec.rb