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

pipeline_schedules_helper_spec.rb « ci « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ba24a08b5876a1e46bd8d19709b53ce108121d4 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Ci::PipelineSchedulesHelper, feature_category: :continuous_integration do
  let_it_be(:project) { build_stubbed(:project) }
  let_it_be(:user) { build_stubbed(:user) }
  let_it_be(:pipeline_schedule) { build_stubbed(:ci_pipeline_schedule, project: project, owner: user) }
  let_it_be(:timezones) { [{ identifier: "Pacific/Honolulu", name: "Hawaii" }] }

  let_it_be(:pipeline_schedule_variable) do
    build_stubbed(:ci_pipeline_schedule_variable, key: 'foo', value: 'foovalue', pipeline_schedule: pipeline_schedule)
  end

  describe '#js_pipeline_schedules_form_data' do
    before do
      allow(helper).to receive(:timezone_data).and_return(timezones)
    end

    it 'returns pipeline schedule form data' do
      expect(helper.js_pipeline_schedules_form_data(project, pipeline_schedule)).to include({
        full_path: project.full_path,
        daily_limit: nil,
        project_id: project.id,
        schedules_path: pipeline_schedules_path(project),
        settings_link: project_settings_ci_cd_path(project),
        timezone_data: timezones.to_json
      })
    end
  end
end