Share common factory setup

This commit is contained in:
Matt Jankowski 2025-07-25 11:58:12 -04:00
parent caf29d8ad8
commit e2d114f00b

View File

@ -4,8 +4,9 @@ require 'rails_helper'
RSpec.describe Admin::DashboardHelper do RSpec.describe Admin::DashboardHelper do
describe 'relevant_account_timestamp' do describe 'relevant_account_timestamp' do
let(:account) { Fabricate(:account) }
context 'with an account with older sign in' do context 'with an account with older sign in' do
let(:account) { Fabricate(:account) }
let(:stamp) { 10.days.ago } let(:stamp) { 10.days.ago }
it 'returns a time element' do it 'returns a time element' do
@ -18,8 +19,6 @@ RSpec.describe Admin::DashboardHelper do
end end
context 'with an account with newer sign in' do context 'with an account with newer sign in' do
let(:account) { Fabricate(:account) }
it 'returns a time element' do it 'returns a time element' do
account.user.update(current_sign_in_at: 10.hours.ago) account.user.update(current_sign_in_at: 10.hours.ago)
result = helper.relevant_account_timestamp(account) result = helper.relevant_account_timestamp(account)
@ -29,8 +28,6 @@ RSpec.describe Admin::DashboardHelper do
end end
context 'with an account where the user is pending' do context 'with an account where the user is pending' do
let(:account) { Fabricate(:account) }
it 'returns a time element' do it 'returns a time element' do
account.user.update(current_sign_in_at: nil) account.user.update(current_sign_in_at: nil)
account.user.update(approved: false) account.user.update(approved: false)
@ -42,7 +39,6 @@ RSpec.describe Admin::DashboardHelper do
end end
context 'with an account with a last status value' do context 'with an account with a last status value' do
let(:account) { Fabricate(:account) }
let(:stamp) { 5.minutes.ago } let(:stamp) { 5.minutes.ago }
it 'returns a time element' do it 'returns a time element' do
@ -56,8 +52,6 @@ RSpec.describe Admin::DashboardHelper do
end end
context 'with an account without sign in or last status or pending' do context 'with an account without sign in or last status or pending' do
let(:account) { Fabricate(:account) }
it 'returns a time element' do it 'returns a time element' do
account.user.update(current_sign_in_at: nil) account.user.update(current_sign_in_at: nil)
result = helper.relevant_account_timestamp(account) result = helper.relevant_account_timestamp(account)