ruby on rails - Testing mailer 'from' header using rspec -
i working on ruby on rails project, trying test 'from' header field test case fails.
here setting in mailer action
def some_actoin mail(to: xyz@example.com, from: '"example" <service@example.com>', subject: "test subject") end end and in rspec test case,
mail.from.should == '"example" <service@example.com>' my test case failing following error
expected: '"example" <service@example.com>' got: [service@example.com] (using ==) is wrong way test from-header title from-header email address?
appreciates help!
the mail.from contains email address. you'll want test display name too.
mail.from.should eq(['service@example.com']) mail[:from].display_names.should eq(['example'])
Comments
Post a Comment