summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/gitlab/change_timezone_spec.rb
blob: 1e4b4048cf490dc757d6cef4cc9f2440edb5328b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/change_timzone'

describe RuboCop::Cop::Gitlab::ChangeTimezone do
  include CopHelper

  subject(:cop) { described_class.new }

  context 'Time.zone=' do
    it 'registers an offense with no 2nd argument' do
      expect_offense(<<~PATTERN)
        Time.zone = 'Awkland'
        ^^^^^^^^^^^^^^^^^^^^^ Do not change timezone in the runtime (application or rspec), it could result in silently modifying other behavior.
      PATTERN
    end
  end
end