chore: Add assigned option to conversation finder API (#2630)

- Adds the ability to filter all the conversations which are assigned
- Add rack timeout gem
- Remove size attribute from Sidekiq config
This commit is contained in:
Sojan Jose
2021-07-14 22:51:27 +05:30
committed by GitHub
parent 3d18ec9e40
commit d7982a6ffd
12 changed files with 153 additions and 70 deletions

View File

@@ -6,7 +6,7 @@ describe ::ConversationFinder do
let!(:account) { create(:account) }
let!(:user_1) { create(:user, account: account) }
let!(:user_2) { create(:user, account: account) }
let!(:inbox) { create(:inbox, account: account) }
let!(:inbox) { create(:inbox, account: account, enable_auto_assignment: false) }
before do
create(:inbox_member, user: user_1, inbox: inbox)
@@ -15,6 +15,8 @@ describe ::ConversationFinder do
create(:conversation, account: account, inbox: inbox, assignee: user_1)
create(:conversation, account: account, inbox: inbox, assignee: user_1, status: 'resolved')
create(:conversation, account: account, inbox: inbox, assignee: user_2)
# unassigned conversation
create(:conversation, account: account, inbox: inbox)
Current.account = account
end
@@ -28,10 +30,28 @@ describe ::ConversationFinder do
end
end
context 'with assignee' do
context 'with assignee_type all' do
let(:params) { { assignee_type: 'all' } }
it 'filter conversations by assignee' do
it 'filter conversations by assignee type all' do
result = conversation_finder.perform
expect(result[:conversations].count).to be 4
end
end
context 'with assignee_type unassigned' do
let(:params) { { assignee_type: 'unassigned' } }
it 'filter conversations by assignee type unassigned' do
result = conversation_finder.perform
expect(result[:conversations].count).to be 1
end
end
context 'with assignee_type assigned' do
let(:params) { { assignee_type: 'assigned' } }
it 'filter conversations by assignee type assigned' do
result = conversation_finder.perform
expect(result[:conversations].count).to be 3
end

View File

@@ -20,14 +20,6 @@ describe ::Redis::Config do
expect(app_config[:url]).to eq(redis_url)
expect(app_config[:password]).to eq(redis_pasword)
end
it 'checks for sidekiq redis config' do
sidekiq_config = described_class.sidekiq
expect(sidekiq_config.keys).to match_array([:url, :password, :size, :network_timeout, :reconnect_attempts])
expect(sidekiq_config[:url]).to eq redis_url
expect(sidekiq_config[:password]).to eq redis_pasword
expect(sidekiq_config[:size]).to eq described_class::SIDEKIQ_SIZE
end
end
context 'when redis sentinel is used' do
@@ -58,10 +50,5 @@ describe ::Redis::Config do
expect(described_class.app[:url]).to eq("redis://#{redis_master_name}")
expect(described_class.app[:sentinels]).to match_array(expected_sentinels)
end
it 'checks for sidekiq redis config' do
expect(described_class.sidekiq.keys).to match_array([:url, :password, :sentinels, :size, :network_timeout, :reconnect_attempts])
expect(described_class.sidekiq[:size]).to eq described_class::SIDEKIQ_SIZE
end
end
end