Skip to content

Upgrade act as list gem, implement tests to check deal position behaviour and fix bug when change deal between stages from position 1#592

Merged
douglara merged 7 commits intodevelopmentfrom
upgrade-act-as-list-gem
Feb 16, 2026
Merged

Upgrade act as list gem, implement tests to check deal position behaviour and fix bug when change deal between stages from position 1#592
douglara merged 7 commits intodevelopmentfrom
upgrade-act-as-list-gem

Conversation

@YukioArie
Copy link
Collaborator

No description provided.

Comment on lines 21 to 34
it 'move stage1_position1 to stage2 position 1 and create deal_stage_change event' do
expect do
Deal::CreateOrUpdate.new(stage1_position1, { stage: stage2, position: 1 }).call
end.to change(Event, :count).by(1)

expect(stage1_position2.reload.position).to eq 1
expect(stage1_position3.reload.position).to eq 2

expect(stage1_position1.reload.position).to eq 1
expect(stage2_position1.reload.position).to eq 2
expect(stage2_position2.reload.position).to eq 3
expect(stage2_position3.reload.position).to eq 4
expect(last_event.kind).to eq('deal_stage_change')
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Criei esse pr, pois esse teste está falhando.
E se analisar, parece ser um bug da gem act_as_list.
Fiz o update da gem para a ultima versão, mas esse teste ainda está falhando.

Copy link
Collaborator Author

@YukioArie YukioArie Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abri uma issue no repostorio da gem act_as_list, e o rapaz que me respondeu falou que esse bug acontece pq as positions estão com default: 1. Removendo o default, esse bug é corrigido. Fiz isso nesse commit fdfaf83 e esse teste parou de falhar.
Segue o q o rapaz comentou:
So yes, you do have a default of 1 for that column. You'll need to remove this. It's best if this column doesn't have a default. What is happening is that acts_as_list can't see that the column value is being set explicitly so it's adding the record to the end of the table. Let me know how you get on

@YukioArie YukioArie changed the title Upgrade act as list gem and implement tests to check deal position behaviour Upgrade act as list gem, implement tests to check deal position behaviour and fix bug when change deal between stages from position 1 Feb 13, 2026
@douglara douglara merged commit a0c917f into development Feb 16, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants