diff options
Diffstat (limited to 'spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb b/spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb index d23f95b2e9e..cf38a583944 100644 --- a/spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb +++ b/spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb @@ -122,6 +122,22 @@ RSpec.shared_examples 'value stream analytics stage' do expect(stage.parent_id).to eq(parent.id) end end + + describe '#hash_code' do + it 'does not differ when the same object is built with the same params' do + stage_1 = build(factory) + stage_2 = build(factory) + + expect(stage_1.events_hash_code).to eq(stage_2.events_hash_code) + end + + it 'differs when the stage events are different' do + stage_1 = build(factory, start_event_identifier: :merge_request_created, end_event_identifier: :merge_request_merged) + stage_2 = build(factory, start_event_identifier: :issue_created, end_event_identifier: :issue_first_mentioned_in_commit) + + expect(stage_1.events_hash_code).not_to eq(stage_2.events_hash_code) + end + end end RSpec.shared_examples 'value stream analytics label based stage' do |