我在lib目录中有一些类,我想测试它。我想测试的课程如下:
class StatAggregation
class << self
def skills_rate(user_id)
user_id = User.find_by_id(user_id)
...
end
end
end
我创建了规范:
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe StatAggregation do
fixtures [
:users
]
describe 'skills_rate method' do
it 'should work' do
@user_id = 1
@user = mock_model(User)
User.should_receive(:find_by_id).with(@user_id).and_return(@user)
...
StatAggregation.skills_rate(@user_id)
end
end
end
它运作正常,但它没有显示出现错误的地方:
1)
ArgumentError in 'PxStatAggregation skills_rate method should work'
wrong number of arguments (1 for 0)
script/spec:10:
Finished in 0.326331 seconds
如何获得出现错误的行数“错误的参数数量(1为0)”?
答案 0 :(得分:1)
将-b或--backtrace添加到spec命令行或spec.opts文件。