diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index c8edf087b..b9b56840e 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -9,7 +9,7 @@ class UserSerializer project_email_communication beta_email_communication nasa_email_communication uploaded_subjects_count subject_limit admin login_prompt zooniverse_id upload_whitelist valid_email ux_testing_email_communication - intervention_notifications banned + intervention_notifications banned confirmed_at ).freeze attributes :id, :login, :display_name, :credited_name, :email, :languages, @@ -18,7 +18,7 @@ class UserSerializer :subject_limit, :uploaded_subjects_count, :admin, :href, :login_prompt, :private_profile, :zooniverse_id, :upload_whitelist, :avatar_src, :valid_email, :ux_testing_email_communication, :intervention_notifications, - :banned + :banned, :confirmed_at can_include :classifications, :project_preferences, :collection_preferences, projects: { param: "owner", value: "login" }, diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index 5190ecad0..6e042757c 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -392,6 +392,12 @@ expect(result).to eq(user.upload_whitelist) end + it "should have the confirmed_at for the user" do + result = user_response["confirmed_at"] + # Dates are JSON serialized via iso8601 and .to_json adds quotes + expect(result).to eq(user.confirmed_at.iso8601(3)) + end + it_behaves_like "an api response" end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 9d1a11be9..58cec5c91 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -8,8 +8,8 @@ sequence(:email) {|n| "example#{n}@example.com"} password { 'password' } encrypted_password { User.new.send(:password_digest, 'password') } - confirmed_at { Time.current } - confirmation_sent_at { Time.current } + confirmed_at { Time.utc(2024, 1, 1, 12, 0, 0) } + confirmation_sent_at { Time.utc(2024, 1, 1, 12, 0, 0) } credited_name { 'Dr User' } activated_state { :active } sequence(:login) { |n| "new_user_#{n}" }