vendredi 27 mai 2016

Add module to Test Class

To a test class, Im trying to add a module:

require "test_helper"
require "before_find_helper"

class User::FindOrCreateTest < ActiveSupport::TestCase
  include BeforeFindHelper

the module looks like this one:

module BeforeFindHelper
  extend ActiveSupport::Concern

  self.before do
    class FakeController < ApplicationController
     ......
    end
  end
end

Basically before the before-block was defined in the controller and everything worked fine:

  before do
    class FakeController < ApplicationController
     ......
    end
  end

But now with the included module I get this error when running the Test:

undefined method `before' for BeforeFindHelper:Module

How can I get the tests working again? Thanks

Aucun commentaire:

Enregistrer un commentaire