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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/ci/pipeline_schedules_helper_spec.rb')
-rw-r--r--spec/helpers/ci/pipeline_schedules_helper_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/helpers/ci/pipeline_schedules_helper_spec.rb b/spec/helpers/ci/pipeline_schedules_helper_spec.rb
new file mode 100644
index 00000000000..2a81c2a44a0
--- /dev/null
+++ b/spec/helpers/ci/pipeline_schedules_helper_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::PipelineSchedulesHelper, :aggregate_failures do
+ describe '#timezone_data' do
+ subject { helper.timezone_data }
+
+ it 'matches schema' do
+ expect(subject).not_to be_empty
+ subject.each_with_index do |timzone_hash, i|
+ expect(timzone_hash.keys).to contain_exactly(:name, :offset, :identifier), "Failed at index #{i}"
+ end
+ end
+
+ it 'formats for display' do
+ first_timezone = ActiveSupport::TimeZone.all[0]
+
+ expect(subject[0][:name]).to eq(first_timezone.name)
+ expect(subject[0][:offset]).to eq(first_timezone.now.utc_offset)
+ expect(subject[0][:identifier]).to eq(first_timezone.tzinfo.identifier)
+ end
+ end
+end