Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
切换到新的 expect() 语法。
得到
syntax error, unexpected tASSOC, expecting '}' (SyntaxError)
为了这:
expect(subject.crumbs.last.data).to eq {:foo => :bar }
如何修复此语法错误?
另一种修复方法:
expect(subject.crumbs.last.data).to eq(foo: :bar)
(红宝石 1.9+)
此代码有效(在 eq 值周围添加括号):
expect(subject.crumbs.last.data).to eq({:foo => :bar })