Skip to content

Commit

Permalink
Some more spec grooming
Browse files Browse the repository at this point in the history
  • Loading branch information
bryckbost committed Jan 13, 2012
1 parent 14cfa87 commit b5cf19d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions spec/performable_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def signup(email)
it "should enqueue a PerformableEmail job" do
lambda {
job = MyMailer.delay.signup('john@example.com')
job.payload_object.class.should == Delayed::PerformableMailer
job.payload_object.method_name.should == :signup
job.payload_object.args.should == ['john@example.com']
job.payload_object.class.should == Delayed::PerformableMailer
job.payload_object.method_name.should == :signup
job.payload_object.args.should == ['john@example.com']
}.should change { Delayed::Job.count }.by(1)
end
end
Expand All @@ -29,16 +29,14 @@ def signup(email)

describe Delayed::PerformableMailer do
describe "perform" do
before do
@email = mock('email', :deliver => true)
@mailer_class = mock('MailerClass', :signup => @email)
@mailer = Delayed::PerformableMailer.new(@mailer_class, :signup, ['john@example.com'])
end

it "should call the method and #deliver on the mailer" do
@mailer_class.should_receive(:signup).with('john@example.com')
@email.should_receive(:deliver)
@mailer.perform
email = mock('email', :deliver => true)
mailer_class = mock('MailerClass', :signup => email)
mailer = Delayed::PerformableMailer.new(mailer_class, :signup, ['john@example.com'])

mailer_class.should_receive(:signup).with('john@example.com')
email.should_receive(:deliver)
mailer.perform
end
end
end
Expand Down

0 comments on commit b5cf19d

Please sign in to comment.