From 578aaf6701658aa23b373ddc36a448ec92448dc8 Mon Sep 17 00:00:00 2001 From: Dean Lofts Date: Mon, 2 Sep 2024 13:24:35 +1000 Subject: [PATCH] fix tests --- spec/controllers/users/registrations_controller_spec.rb | 6 +++--- spec/factories/users.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 56ba840..5fddefd 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -1,4 +1,3 @@ -# spec/controllers/users/registrations_controller_spec.rb require 'rails_helper' RSpec.describe Users::RegistrationsController, type: :controller do @@ -9,7 +8,7 @@ describe "POST #create" do let(:valid_attributes) { { email: "test@example.com", password: "password", password_confirmation: "password", - username: "testuser", full_name: "Test User", tags: "tag1,tag2" } + username: "testuser", full_name: "Test User", tags: "tag1,tag2", avatar_border: "white" } } it "creates a new User" do @@ -35,7 +34,7 @@ context "with valid params" do let(:new_attributes) { - { full_name: "New Name", tags: "new_tag1,new_tag2" } + { full_name: "New Name", tags: "new_tag1,new_tag2", avatar_border: "black" } } it "updates the requested user" do @@ -44,6 +43,7 @@ expect(user.full_name).to eq("New Name") tags = user.tags.is_a?(String) ? JSON.parse(user.tags) : user.tags expect(tags).to eq(["new_tag1", "new_tag2"]) + expect(user.avatar_border).to eq("black") end end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 49b66d0..6339d72 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,4 +1,3 @@ -# spec/factories/users.rb FactoryBot.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } @@ -6,6 +5,7 @@ password_confirmation { "password123" } sequence(:username) { |n| "user#{n}" } full_name { "Test User" } - tags { ["tag1", "tag2"] } + tags { ["tag1", "tag2"].to_json } + avatar_border { ['white', 'black', 'none'].sample } end end \ No newline at end of file