def valid_attributes @api_key = FactoryGirl.create(:api_key, id: Moped::BSON::ObjectId.new) end
it "creates a new ApiKey" do expect { post :create, { :api_key => valid_attributes }, valid_session }.to change(ApiKey, :count).by(1) end
如上所示,我正在尝试在ApiKey上测试POST创建方法。虽然测试会抛出如下错误。
Failure/Error: post :create, { :api_key => valid_attributes[:_id] }, valid_session NoMethodError: undefined method `reject' for "51645d865c5f48e298000002":String
有没有人见过这种类型的错误?