Sha256: ba3ad5ec84fb3a26d05b099a125d38dc75cbe5fd9b871364176e96eda2f473cd

Contents?: true

Size: 1.73 KB

Versions: 21

Compression:

Stored size: 1.73 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

# These two example groups are specifying the exact same behavior.  However, the documentation style is different
# and the value that each one provides is different with various trade-offs.  Run these examples with the specdoc 
# formatter to get an idea of how they differ.

# Example of documenting the behaviour explicitly and expressing the intent in the example's sentence.
describe "Signup Email" do
  include EmailSpec::Helpers
  include EmailSpec::Matchers
  include ActionController::UrlWriter

  before(:all) do
    @email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks")
  end

  subject { @email }
  
  it "should be delivered to the email passed in" do
    should deliver_to("jojo@yahoo.com")
  end
  
  it "should contain the user's name in the mail body" do
    @email.should have_body_text(/Jojo Binks/)
  end

  it "should contain a link to the confirmation page" do
    @email.should have_body_text(/#{confirm_account_url}/)
  end
  
  it { should have_subject(/Account confirmation/) }
  
  
end

# In this example group more of the documentation is placed in the context trying to allow for more concise specs.
describe "Signup Email" do
  include EmailSpec::Helpers
  include EmailSpec::Matchers
  include ActionController::UrlWriter

  before(:all) do
    @email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks")
  end

  subject { @email }

  it { should have_body_text(/#{confirm_account_url}/) }
  it { should have_subject(/Account confirmation/) }

  describe "sent with email address of 'jojo@yahoo.com', and users name 'Jojo Binks'" do
    subject { @email }
    it { should deliver_to("jojo@yahoo.com") }
    it { should have_body_text(/Jojo Binks/) }
  end
  
  
end

Version data entries

21 entries across 21 versions & 8 rubygems

Version Path
basiszwo-email_spec-0.1.3 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.0.10 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.0.9 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.1.0 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.1.1 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.1.2 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.1.3 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.1.4 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.2.0 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.2.1 examples/rails_root/spec/models/user_mailer_spec.rb
bmabey-email_spec-0.3.0 examples/rails_root/spec/models/user_mailer_spec.rb
craigw-email_spec-0.1.4 examples/rails_root/spec/models/user_mailer_spec.rb
hectoregm-email_spec-0.1.2 examples/rails_root/spec/models/user_mailer_spec.rb
hectoregm-email_spec-0.1.3 examples/rails_root/spec/models/user_mailer_spec.rb
leondu-email_spec-0.1.4 examples/rails_root/spec/models/user_mailer_spec.rb
rainchen-email_spec-0.1.4 examples/rails_root/spec/models/user_mailer_spec.rb
tpitale-email_spec-0.2.1 examples/rails_root/spec/models/user_mailer_spec.rb
tpitale-email_spec-0.2.2 examples/rails_root/spec/models/user_mailer_spec.rb
email_spec-0.3.0 examples/rails_root/spec/models/user_mailer_spec.rb
email_spec-0.2.1 examples/rails_root/spec/models/user_mailer_spec.rb