Skip to content

Commit

Permalink
[improvement]: favor request specs, reduce created contributors (#2001)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwr18 authored Aug 29, 2024
1 parent e6e6283 commit 26f34ad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
29 changes: 29 additions & 0 deletions spec/requests/admin/stats_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Stats' do
context 'as admin' do
subject { -> { get admin_stats_path(as: user) } }
let(:user) { create(:user, admin: true) }
let(:mock_validator) { instance_double(ThreemaValidator) }

before do
create_list(:contributor, 1)
create_list(:contributor, 1, :threema_contributor, :skip_validations)
create_list(:contributor, 2, :telegram_contributor)
create_list(:contributor, 1, :signal_contributor)
create_list(:contributor, 2, :signal_contributor_uuid)
create_list(:contributor, 6, :whats_app_contributor)
subject.call
end

it 'admin edits contributor', flaky: true do
expect(page).to have_content('Email contributors: 1')
expect(page).to have_content('Threema contributors: 1')
expect(page).to have_content('Telegram contributors: 2')
expect(page).to have_content('Signal contributors: 3')
expect(page).to have_content('WhatsApp contributors: 6')
end
end
end
29 changes: 0 additions & 29 deletions spec/system/admin/stats_spec.rb

This file was deleted.

0 comments on commit 26f34ad

Please sign in to comment.