Spork test success dependency with undefined method error? #187

dtuite opened this Issue Apr 11, 2012 · 1 comment

2 participants


I have a standard Rails 3.2 app with some weird behavior going on.

I can run rspec spec/ without spork running and all tests pass no problem.

Then I fire up spork and run the specs again. This time, every test that touches one of my mailers will fail with the same error:


  1) InvitationsController GET accept with non-matching token should redirect to the root path
     Failure/Error: let!(:invitation) { Factory :invitation }
       undefined method `invite' for InvitationMailer:Class
     # ./app/models/invitation.rb:29:in `send_email'
     # ./spec/controllers/invitations_controller_spec.rb:5:in `block (3 levels) in <top (required)>'

Then, just to make it all a little weirder, I can run individual directories or specs, with or without spork running, and everything passes no problem. e.g rspec spec/mailers or rspec spec/models.

Here is the method which I am being told is undefined:

class InvitationMailer < ActionMailer::Base
  default from: APP_CONFIG[:default_from]

  def invite(invitation)
    @invitation = invitation

    mail(to: @invitation.recipient_email, subject: "the subject")

Any ideas what could be happening?


I have a similar problem. Was there every a resolution to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment