Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:14:20+00:00 2026-05-27T10:14:20+00:00

I am writing a test for my email service, inside my email template file

  • 0

I am writing a test for my email service, inside my email template file I call a helper method called: do_it, which is defined inside application_helper.rb

However, when i run my tests they fail because the helper methods are not imported, I get the following exception:

NoMethodError: undefined method `do_it' 

Any idea / suggestions on how i can import helper methods into tests?

I am using:

require 'test_helper'

class NotifierTest < ActionMailer::TestCase
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:14:21+00:00Added an answer on May 27, 2026 at 10:14 am

    A Helper is just a module containing instance level methods. RSpec gives you a way to access this by default in the Helper specs that are automatically generated, by using helper.x within the describe block for the helper. If you’re not using RSpec, there may be some other method provided by your test framework. Alternatively, you can mix the module into a class and test on an instance of the class.

    Somewhere in the test setup:

    class ApplicationHelperTest; include ApplicationHelper; end
    @helper = ApplicationHelperTest.new
    

    And in your test:

    assert @helper.do_it
    

    To better address your exact issue, what you need to do then is include the helper in the class that the method is being called on. For example, let’s say the class is Mailer:

    Mailer.send(:include, ApplicationHelper)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a simple email helper class that will be called by a
I am writing an application which tests email addresses, for one part of this
I writing test cases for Android apps using Robotium. One of my test cases
In writing Test case as I know, first step/task is to identify the Test
I'm writing test code that needs to clean up the entities it creates when
I'm fairly new to writing test cases and this will be my first major
We want to design a simple domain specific language for writing test scripts to
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
I'm writing a test case where I'm trying to use mockito to avoid entering
I am writing a test using easymock + powermock, the reason I am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.