Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210503105845_add_project_value_stream_id_to_project_stages_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6e1cc63e42ae5b5681d56b3dcf4fc308f84a5082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'spec_helper'

require Rails.root.join('db', 'migrate', '20210503105845_add_project_value_stream_id_to_project_stages.rb')

RSpec.describe AddProjectValueStreamIdToProjectStages, schema: 20210503105022 do
  let(:stages) { table(:analytics_cycle_analytics_project_stages) }
  let(:namespaces) { table(:namespaces) }
  let(:projects) { table(:projects) }

  let(:namespace) { table(:namespaces).create!(name: 'ns1', path: 'nsq1') }

  before do
    project = projects.create!(name: 'p1', namespace_id: namespace.id)

    stages.create!(
      project_id: project.id,
      created_at: Time.now,
      updated_at: Time.now,
      start_event_identifier: 1,
      end_event_identifier: 2,
      name: 'stage 1'
    )

    stages.create!(
      project_id: project.id,
      created_at: Time.now,
      updated_at: Time.now,
      start_event_identifier: 3,
      end_event_identifier: 4,
      name: 'stage 2'
    )
  end

  it 'deletes the existing rows' do
    migrate!

    expect(stages.count).to eq(0)
  end
end