【发布时间】:2017-05-02 02:13:17
【问题描述】:
我在 RSpec 中创建了这个对象。我在第二次}, 收到错误unexpected token tCOMMA 知道为什么会收到此错误吗?
let(:test) {
{ abc:
[{ bde:
{ attribute1: 170.0,
attribute2: '2016-12-14',
attribute3: 'self entered',
attribute4: 'high',
attribute5:
{ attribute6: 'low',
attribute7: false,
attribute8: nil,
attribute9: 129,
attribute0: 'mg/dL'},
{ attribute11: 'moderate',
attribute12: false,
attribute13: 130,
attribute14: 159,
attribute15: 'mg/dL' }, # getting error unexpected token tCOMMA
{ attribute16: 'high',
attribute17: true,
attribute18: 160,
attribute19: nil,
attribute20: 'mg/dL' }
}
}]
}}
【问题讨论】:
-
如果你的代码格式正确,你会看到
attribute5应该是一个数组
标签: ruby-on-rails ruby-on-rails-4 rspec rspec-rails