unexpected =>, expecting '}' in rspec expect

后端 未结 2 1405
别跟我提以往
别跟我提以往 2021-01-27 05:21

I have this code:

adapter.send(:conditions_to_fields, :user => user).should == {\'owner_id\' => user.id}

which I updated to use expect wi

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-27 05:43

    It thinks you’re passing a block to eq, not a hash. You can solve this by using parentheses around the method arguments:

    expect(adapter.foo).to eq({'owner_id' => user.id})
    

提交回复
热议问题