Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2468

specs, let vs let!, and Mongoid::Errors::Callback

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.10
    • Affects Version/s: None
    • Component/s: None

      I'm in the process of upgrading to 3.x and ran into a weird issue in my controller specs.

      Unable to find source-code formatter for language: `. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      describe DiseasesController do
        let(:disease) {Fabricate(:disease)}
      
        it "assigns the disease as @disease" do
          put :update, id: disease.id.to_s, disease: {}
          assigns(:disease).should eq(disease)
        end
      
      etc...
      

      `

      The above, which used to work fine, now produces Mongoid::Errors::Callback. This is the case when using Fabricator or FactoryGirl. The model does not have callbacks and I even tried commenting all validations, methods, fields, etc... Changing the let to let! fixes the issue. I'm not sure why this is occurring and any help is appreciated.

            Assignee:
            Unassigned Unassigned
            Reporter:
            astjohn Adam St. John
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: