heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
24.02k stars 5.55k forks source link

Potential Update for Rails7 with Ruby3.1 #5721

Open mikeh-dev opened 1 month ago

mikeh-dev commented 1 month ago

https://github.com/heartcombo/devise/blob/12c796e4994c9fbdc12eb0d6b70450cf82fcec62/test/rails_app/config/initializers/devise.rb#L102

Environment

Current behaviour

I ran into a failing test with Rspec on the valid email check

The original regex here;

config.email_regexp =/^([\w.%+-]+)@([\w-]+.)+([\w]{2,})$/i

was failing on a new line error

Solution

I corrected to

/\A([\w.%+-]+)@([\w-]+.)+([\w]{2,})\z/i

Basically the same but changing the start and end removed the multiline anchors error for me. OLD uses ^ and $: Matches start/end of any line NEW uses \A and \z: Matches start/end of entire string

Not sure if this is correct as this is my first contribution but I came across and thought I would drop it in.

Cheers

JalisoCSP commented 3 weeks ago

Seems legit to me

You should make a PR :) 👏

mikeh-dev commented 3 weeks ago

Seems legit to me

You should make a PR :) 👏

Cheers! I'll get onto it