From c91a72da16e66bc65d6a54ee802d7e43d5af7a28 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Sat, 31 Aug 2024 22:38:21 -0700 Subject: [PATCH] attempt at tests, but cant run locally tso runnning on ci --- spec/support/stories/profile_stories.rb | 16 +++++++++++++++- spec/system/profile_spec.rb | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/spec/support/stories/profile_stories.rb b/spec/support/stories/profile_stories.rb index 07eaaca9fb93b0..cad06a17e57426 100644 --- a/spec/support/stories/profile_stories.rb +++ b/spec/support/stories/profile_stories.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module ProfileStories - attr_reader :bob, :alice, :alice_bio + attr_reader :bob, :alice, :alice_bio, :chupacabra, :chupacabra_css def fill_in_auth_details(email, password) fill_in 'user_email', with: email @@ -43,6 +43,20 @@ def with_alice_as_local_user ) end + def with_chupacabras_fancy_profile + @chupacabra_css = <<~CSS + body { + background-color: red !important; + } + CSS + + @chupacabra = Fabricate( + :user, + email: 'chupacabra@example.com', password: password, confirmed_at: confirmed_at, + account: Fabricate(:account, username: 'chupacabra', note: 'I am gonna getcha!', account_css: @chupacabra_css) + ) + end + def confirmed_at @confirmed_at ||= Time.zone.now end diff --git a/spec/system/profile_spec.rb b/spec/system/profile_spec.rb index 2517e823b50c5f..b3f7dc95dd070b 100644 --- a/spec/system/profile_spec.rb +++ b/spec/system/profile_spec.rb @@ -12,6 +12,7 @@ before do as_a_logged_in_user with_alice_as_local_user + with_chupacabras_fancy_profile end it 'I can view Annes public account' do @@ -30,4 +31,14 @@ expect(subject).to have_content 'Changes successfully saved!' end + + it 'Can have custom account_css set' do + visit account_path('chupacabra') + expect(subject).to include('background-color: red !important') + expect(subject).to have_xpath('//*[@id="account-css"]') + + visit account_path('alice') + expect(subject).to_not include('background-color: red !important') + expect(subject).to have_no_xpath('//*[@id="account-css"]') + end end