Skip to content

Commit

Permalink
Use .first in place of [0]
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Feb 5, 2017
1 parent c57d2b2 commit c7dc3ee
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/integration/user_creation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_user_create_success
# 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

Expand Down Expand Up @@ -132,13 +132,13 @@ def test_user_create_redirect
# 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
Expand Down Expand Up @@ -245,13 +245,13 @@ def test_user_create_openid_redirect
# 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
Expand Down Expand Up @@ -362,13 +362,13 @@ def test_user_create_google_redirect
# 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
Expand Down Expand Up @@ -475,13 +475,13 @@ def test_user_create_facebook_redirect
# 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
Expand Down Expand Up @@ -588,13 +588,13 @@ def test_user_create_windowslive_redirect
# 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
Expand Down Expand Up @@ -701,13 +701,13 @@ def test_user_create_github_redirect
# 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
Expand Down Expand Up @@ -814,13 +814,13 @@ def test_user_create_wikipedia_redirect
# 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
Expand Down

0 comments on commit c7dc3ee

Please sign in to comment.