rspec error => '123455760'的未定义'拒绝':字符串

时间:2013-04-09 18:30:48

标签: post rspec rspec-rails

    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

有没有人见过这种类型的错误?

0 个答案:

没有答案