1

I have one main rails app, and I have an engine within it, now the engine has a different test, I need to test one controller which is using main app MailerHelper module. How can I access in my spec.

My engine's user controller

module ControlPanel 
  class UserController < ApplicationController
    include MailerHelper
    def index 
      @users = User.all
    end
  end
end

I am using MailerHelper have many other methods which sent mails. As this is controller is in my engine control panel, following is specification in my engine

require 'rails_helper'

describe ControlPanel::UsersController, type: :controller do
  describe '#index' do
    it 'should display all users' do
      get :index
      expect(response).to render_template('index')
    end
  end
end

The test case is just simple, but as in my engines User controller I am using my main application helper, so it can't take it, I have seen many replies but nothing working, like including in rails_spec and ::MailerHelper etc.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.