Method error for rspec

Hi,

I’m getting the error below, can someone explain what I need to do?

Failure/Error: @numbers.exchange(1).should be_true
NoMethodError:
private method ‘exchange’ called for #<Numbers_Game>

./numbers_spec.rb:55:in ‘block (2 levels) in <top (required)>’

Greatly appreciated

Richy

On Fri, Nov 22, 2013 at 10:41 AM, Richard J. [email protected]
wrote:

I’m getting the error below, can someone explain what I need to do?

Failure/Error: @numbers.exchange(1).should be_true
NoMethodError:
private method ‘exchange’ called for #<Numbers_Game>

./numbers_spec.rb:55:in ‘block (2 levels) in <top (required)>’

It’s saying that at line 55 of numbers_spec.rb, you call
@numbers.exchange(1), but the “exchange” method is private, so you
can’t call it there. You need to rearrange your code so that you can
test it using only public methods. You can simply make exchange
public, or rethink how to expose that functionality.

-Dave

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs