Use `hash_including` to check `AccountFilter` setup in `admin/accounts` controller spec (#27838)
This commit is contained in:
parent
0945e25b8f
commit
49ba5a9f94
|
@ -20,8 +20,7 @@ RSpec.describe Admin::AccountsController do
|
||||||
it 'filters with parameters' do
|
it 'filters with parameters' do
|
||||||
account_filter = instance_double(AccountFilter, results: Account.all)
|
account_filter = instance_double(AccountFilter, results: Account.all)
|
||||||
allow(AccountFilter).to receive(:new).and_return(account_filter)
|
allow(AccountFilter).to receive(:new).and_return(account_filter)
|
||||||
|
params = {
|
||||||
get :index, params: {
|
|
||||||
origin: 'local',
|
origin: 'local',
|
||||||
by_domain: 'domain',
|
by_domain: 'domain',
|
||||||
status: 'active',
|
status: 'active',
|
||||||
|
@ -31,17 +30,9 @@ RSpec.describe Admin::AccountsController do
|
||||||
ip: '0.0.0.42',
|
ip: '0.0.0.42',
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(AccountFilter).to have_received(:new) do |params|
|
get :index, params: params
|
||||||
h = params.to_h
|
|
||||||
|
|
||||||
expect(h[:origin]).to eq 'local'
|
expect(AccountFilter).to have_received(:new).with(hash_including(params))
|
||||||
expect(h[:by_domain]).to eq 'domain'
|
|
||||||
expect(h[:status]).to eq 'active'
|
|
||||||
expect(h[:username]).to eq 'username'
|
|
||||||
expect(h[:display_name]).to eq 'display name'
|
|
||||||
expect(h[:email]).to eq 'local-part@domain'
|
|
||||||
expect(h[:ip]).to eq '0.0.0.42'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'paginates accounts' do
|
it 'paginates accounts' do
|
||||||
|
|
Loading…
Reference in New Issue