Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

improved rspec syntax

  • Loading branch information...
commit 7068023c975899bee708af1fbd7e735265429832 1 parent 69f85de
Dan Gebhardt dgeb authored

Showing 1 changed file with 23 additions and 21 deletions. Show diff stats Hide diff stats

  1. +23 21 spec/models/email_spec.rb
44 spec/models/email_spec.rb
@@ -4,19 +4,19 @@
4 4 let(:email) { DelayedMailhopper::Email.new }
5 5
6 6 it "should require a from address" do
7   - assert !email.valid?
  7 + email.should_not be_valid
8 8 email.from_address = 'user@example.com'
9   - assert email.valid?
  9 + email.should be_valid
10 10 end
11 11
12 12 describe "generated by a mailer" do
13 13 let(:headers) {{
14   - :from => 'from@example.com',
15   - :to => 'to@example.com',
16   - :cc => 'cc@example.com',
17   - :bcc => 'bcc@example.com',
  14 + :from => 'from@example.com',
  15 + :to => 'to@example.com',
  16 + :cc => 'cc@example.com',
  17 + :bcc => 'bcc@example.com',
18 18 :reply_to => 'reply_to@example.com',
19   - :subject => 'Hiya!'
  19 + :subject => 'Hiya!'
20 20 }}
21 21 let(:content) { 'Papaya' }
22 22
@@ -26,39 +26,41 @@
26 26
27 27 it "should match the intended headers and content" do
28 28 email = DelayedMailhopper::Email.first
29   - assert_equal email.from_address, headers[:from]
30   - assert_equal email.to_address, headers[:to]
31   - assert_equal email.cc_address, headers[:cc]
32   - assert_equal email.bcc_address, headers[:bcc]
33   - assert_equal email.reply_to_address, headers[:reply_to]
34   - assert_equal email.subject, headers[:subject]
  29 + email.from_address.should eq(headers[:from])
  30 + email.to_address.should eq(headers[:to])
  31 + email.cc_address.should eq(headers[:cc])
  32 + email.bcc_address.should eq(headers[:bcc])
  33 + email.reply_to_address.should eq(headers[:reply_to])
  34 + email.subject.should eq(headers[:subject])
35 35
36 36 # Email content will include headers as well as content
37   - assert email.content.include?(content)
  37 + email.content.should include(content)
38 38
39   - assert email.sent_at.nil?
  39 + email.sent_at.should eq(nil)
40 40 end
41 41
42 42 it "should be queued as a delayed job" do
43   - assert_equal DelayedMailhopper::Email.count, 1
44   - assert_equal Delayed::Job.count, 1
  43 + DelayedMailhopper::Email.count.should eq(1)
  44 + Delayed::Job.count.should eq(1)
45 45 end
46 46
47 47 it "should be delivered via DelayedJob" do
48 48 email = DelayedMailhopper::Email.first
49   - assert email.sent_at.nil?
  49 + email.sent_at.should eq(nil)
50 50
51 51 Delayed::Job.first.invoke_job
52 52
53 53 email.reload
54   - assert !email.sent_at.nil?
  54 + email.sent_at.should_not eq(nil)
55 55 end
56 56
57 57 it "should be marked as sent once delivered" do
58 58 email = DelayedMailhopper::Email.first
59   - assert email.sent_at.nil?
  59 + email.sent_at.should eq(nil)
  60 +
60 61 email.send!
61   - assert !email.sent_at.nil?
  62 +
  63 + email.sent_at.should_not eq(nil)
62 64 end
63 65 end
64 66 end

0 comments on commit 7068023

Please sign in to comment.
Something went wrong with that request. Please try again.