Sha256: d7df85f31055a83a1eb9e78bffe568430aeae194e1c0764254c1d1454eda1008

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'rails_helper'

feature "ForgotPasswords", :type => :feature do
  it "should reset your password" do
    user = create :user

    visit new_user_password_path

    within "#new_user" do
      fill_in "user_email", with: user.email
    end

    click_button "Send me reset password instructions"

    # puts ActionMailer::Base.deliveries

    body = ActionMailer::Base.deliveries.last.body

    md = /(\/users\/password\/edit\?reset.*)"/.match( body.to_s )
    if !md
      assert( false, "URL NOT FOUND IN MESSAGE")
    end

    visit md[1]

    within "#new_user" do
      fill_in "user_password", with: "new_password"
      fill_in "user_password_confirmation", with: "new_password"
    end

    click_button "Change my password"

    expect( page.body ).to_not include( "Email can't be blank" )

    visit user_path

    expect( page.body ).to include( "Sign Out")

    click_link "Sign Out"

    expect( page.body ).to include( "Signed out successfully." )
    
    visit new_user_session_path

    within "#new_user" do
      fill_in "user_email", with: user.email
      fill_in "user_password", with: "new_password"
    end

    click_button "Sign in"

    expect( page.body ).to include( "Signed in successfully.")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
happy_seed-0.0.11 lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb
happy_seed-0.0.10 lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb
happy_seed-0.0.9 lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb
happy_seed-0.0.8 lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb