Created
February 27, 2012 15:12
-
-
Save lucasrenan/1924473 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DealersMailer < ActionMailer::Base | |
| default from: "lucas@nudesign.com.br" | |
| def notify_admin(dealer) | |
| @dealer = dealer | |
| mail :to => "lucas@nudesign.com.br", :subject => "novo revendedor cadastrado" | |
| end | |
| def send_confirmation(dealer) | |
| @dealer = dealer | |
| mail :to => @dealer.email, :subject => "seu cadastro foi confirmado" | |
| end | |
| end | |
| ############################################################ | |
| require "spec_helper" | |
| describe DealersMailer do | |
| describe "notify_admin" do | |
| #aqui poderia mockar o model | |
| let(:dealer) { Factory.create(:dealer) } | |
| let(:mail) { DealersMailer.notify_admin(dealer) } | |
| it "renders the headers" do | |
| mail.subject.should eq("novo revendedor cadastrado") | |
| mail.to.should eq(["lucas@nudesign.com.br"]) | |
| mail.from.should eq(["lucas@nudesign.com.br"]) | |
| end | |
| it "renders the body" do | |
| mail.body.encoded.should match(dealer.name) | |
| end | |
| end | |
| describe "send_confirmation" do | |
| #aqui poderia mockar o model | |
| let(:dealer) { Factory.create(:dealer) } | |
| let(:mail) { DealersMailer.send_confirmation(dealer) } | |
| it "renders the headers" do | |
| mail.subject.should eq("seu cadastro foi confirmado") | |
| mail.to.should eq([dealer.email]) | |
| mail.from.should eq(["lucas@nudesign.com.br"]) | |
| end | |
| it "renders the body" do | |
| mail.body.encoded.should match("confirmado") | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment