Sha256: 6777dc4597d7fa745bd456dcece365927c458162fdf0ea0ced85dbfd53b1f5b5

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe "Sign up confirmation feature" do
  let(:user) { FactoryGirl.build :user }

  before :each do
    visit "/"
    click_link "Sign up"
    fill_in "Email", with: user.email
    fill_in "user_password", with: user.password
    fill_in "Password confirmation", with: user.password
    click_button "Sign up"
  end
  
  describe "confirmation email" do
    let(:confirmation_email) { ActionMailer::Base.deliveries.last }
    let(:registered_user) { User.where(email: user.email).first }

    it "has a correct subject" do
      confirmation_email.subject.should eq("Confirmation instructions")
    end

    it "has a correct recipient address" do
      confirmation_email.to.should eq([user.email])
    end

    it "has a correct from address" do
      confirmation_email.from.should eq(["info@example.com"])
    end

    it "includes a confirmation link" do
      confirmation_email.body.should include(
        "http://example.com/confirm/" +
        registered_user.confirmation_token
      )
    end
  end

  describe "visiting the confirmation url" do
    before :each do
      confirmation_url =
        "http://example.com/confirm/" +
        User.where(email: user.email).first.confirmation_token
      visit confirmation_url
    end

    it "displays a success message" do
      page.should have_content "Your account was successfully confirmed"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_application-0.3.1 spec/features/users/sign_up_confirmation_spec.rb
active_application-0.3.0 spec/features/users/sign_up_confirmation_spec.rb
active_application-0.2.0 spec/features/users/sign_up_confirmation_spec.rb
active_application-0.1.0 spec/features/users/sign_up_confirmation_spec.rb
active_application-0.0.1 spec/features/users/sign_up_confirmation_spec.rb