Displaying 1 result from an estimated 1 matches for "mailerscontroller".
2013 May 02
1
trouble-with-capybara-and-rspec-on-a-new-model-spec
...l = mailer.email.downcase }
validates :company_name, length: { maximum: 50 }
validates :contact_name, presence: true, length: { maximum: 40 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }end
Controller:
class MailersController < ApplicationController
def new
@mailer = Mailer.new
end
def create
@mailer = Mailer.new(params[:mailer])
if @mailer.save
redirect_to root_path
else
render ''new''
end
endend
Integration test:
require ''spec_helper''
de...