0
0
Fork 0

Instances list in admin (#2095)

* Add admin/instances index action

* Add link to instances admin page

* View lists instances

* Instances, grouped by domain, ordered by count

* Use Account.remote scope

* Extract method: Account.by_domain_accounts
This commit is contained in:
Matt Jankowski 2017-04-18 15:09:07 -04:00 committed by Eugen
parent 66d8f99a30
commit 55e1503522
8 changed files with 66 additions and 0 deletions

View file

@ -410,6 +410,20 @@ RSpec.describe Account, type: :model do
end
end
describe 'by_domain_accounts' do
it 'returns accounts grouped by domain sorted by accounts' do
2.times { Fabricate(:account, domain: 'example.com') }
Fabricate(:account, domain: 'example2.com')
results = Account.by_domain_accounts
expect(results.length).to eq 2
expect(results.first.domain).to eq 'example.com'
expect(results.first.accounts_count).to eq 2
expect(results.last.domain).to eq 'example2.com'
expect(results.last.accounts_count).to eq 1
end
end
describe 'local' do
it 'returns an array of accounts who do not have a domain' do
account_1 = Fabricate(:account, domain: nil)