The title of this post may be somewhat misleading; I am indeed UNIT
testing this, and it works fine, however I'm also functional testing a
POST to an action that is responsible for creating a new ActiveRecord
object that's associated with the "parent" via has_many :through.
class Report < ActiveRecord::Base
has_many :notifiers, :through => :report_notifiers
class ReportNotifier < ActiveRecord::Base
So, creating a new report with a new notifier would be simple:
@r = Report.new
@r.notifiers << Notifier.create(:label => "something", :email =>
But what happens when a user submits invalid e-mail address? Well, of
course, the validation fails. But how do I go about testing for the
presence of that validation failure message in my functional test?
Here's my existing functional test: