mercredi 30 décembre 2015

wrong number arguments (0 for 1) (ArgumentError)

Looks like rspec is not passing any arguments to the method, even though they're written in the spec file.

The method:

def echo(msg)
  msg
end

The test:

require './echo.rb'

describe echo do
  it 'echoes' do
    expect(echo('hello')).to eq('hello')
  end
end

terminal output:

/home/.../scratch/echo.rb:1:in `echo': wrong number of arguments (0 for 1) (ArgumentError)
from /home/.../scratch/scratch_spec.rb:3:in '<top (required)>'
from /home/.../.rvm/gems/ruby-2.2.1/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1361:in 'load'
...

Aucun commentaire:

Enregistrer un commentaire