Skip to content

Commit

Permalink
attempt at tests, but cant run locally tso runnning on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Sep 1, 2024
1 parent 45fb596 commit c91a72d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
16 changes: 15 additions & 1 deletion spec/support/stories/profile_stories.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: '[email protected]', 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
Expand Down
11 changes: 11 additions & 0 deletions spec/system/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit c91a72d

Please sign in to comment.