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

  • Home
  • SEARCH
  • 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 6369023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:45:00+00:00 2026-05-25T00:45:00+00:00

This should be an easy one to track down…but it isn’t proving that way

  • 0

This should be an easy one to track down…but it isn’t proving that way for me:

I have the following cucumber scenario:

Scenario: Send mail
  Given I am a guest
  When I go to the new_contact page
  And I fill in "contact_name" with "Test User"
  And get mail count
  And I fill in "contact_email" with "test@example.com"
  And I fill in "contact_message" with "Test Message"
  And I fill in "contact_phone_num" with "123456789"
  And I press "Send Message"
  And get mail count

All default steps except for “get mail count”, which simply returns:

puts ActionMailer::Base.deliveries.count

The first step of “get mail count” returns zero, the second returns 2. Running ActionMailer::Base.deliveries confirms the email is identical (including object identifier). I cannot, for the life of me, figure out where that second send is coming from. When actually using the app, the mail only comes through once. Relevant code below:

Controller:

class ContactsController < ApplicationController

  def new
    @contact = Contact.new
    @pagetitle = "Contact Us"
    if (current_user) then
        @contact.name = "#{current_user.first_name} #{current_user.last_name}"
        @contact.email = current_user.email
    end
  end

  def create
    @contact = Contact.new(params[:contact])
      if @contact.save
        contactmailer = ContactMailer
        puts 'here now'
        contactmailer.contact_message(@contact).deliver
        redirect_to contact_thanks_url, notice: 'Contact was successfully created.'
      else
        render action: "new"
      end
  end

  def thanks

  end
end

Mailer:

class ContactMailer < ActionMailer::Base

  def contact_message(contact)
    @contact = contact
    mail(:to => ENV['MANAGER_EMAIL'], :from => @contact.email, :subject => t(:business_name), :content_type => 'text/plain')
  end

end

Cucumber Config File:

BC::Application.configure do
  require 'ruby-debug'
  config.cache_classes = true
  config.use_transactional_fixtures = true

  config.serve_static_assets = true
  config.static_cache_control = "public, max-age=3600"

  config.whiny_nils = true

  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  config.action_dispatch.show_exceptions = false

  config.action_controller.allow_forgery_protection    = false

  config.action_mailer.delivery_method = :test

  config.active_support.deprecation = :stderr

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true

  ENV['MANAGER_EMAIL'] = 'test@example.com'

end
  • 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-25T00:45:00+00:00Added an answer on May 25, 2026 at 12:45 am

    Answer in case anyone has the same issue:

    email_spec gem. The ‘require’ statement in support/features/env.rb was double-calling the mailer. Why I’m not sure, but I uninstalled the gem & everything worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be an easy one, but I'm not finding much online: I have
This should be any easy one for you. I have an accordion that I'd
This should be an easy one. I have a variable that I've already declared
This should be an easy one. I have a table like so: <table> <tr>
argh, this should be an easy one. How can I set the directory that
I think this should be a very easy one, but I cant find the
This should be easy one, I just haven't found any reference to that.
This should be an easy one but it is giving me trouble. Given this
(This should be an easy one... but Googling for it is a mess of
This should be an easy one. How to write a jquery function that gets

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.