From: Tom Hughes Date: Sun, 5 Feb 2017 13:57:25 +0000 (+0000) Subject: Use .first in place of [0] X-Git-Tag: live~3607 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/c7dc3ee722039067332ac29d3badf32abbce2439 Use .first in place of [0] --- diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index 09d2cc1fd..e0a51e4d3 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -92,7 +92,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct assert_match /#{@url}/, register_email.body.to_s @@ -132,13 +132,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -245,13 +245,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_openid/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -362,13 +362,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_google/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -475,13 +475,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_facebook/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -588,13 +588,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_windowslive/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -701,13 +701,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_github/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success @@ -814,13 +814,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest # Check the e-mail register_email = ActionMailer::Base.deliveries.first - assert_equal register_email.to[0], new_email + assert_equal register_email.to.first, new_email # Check that the confirm account url is correct confirm_regex = Regexp.new("/user/redirect_tester_wikipedia/confirm\\?confirm_string=([a-zA-Z0-9]*)") email_text_parts(register_email).each do |part| assert_match confirm_regex, part.body.to_s end - confirm_string = email_text_parts(register_email)[0].body.match(confirm_regex)[1] + confirm_string = email_text_parts(register_email).first.body.match(confirm_regex)[1] # Check the page assert_response :success