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