2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
require 'fast_spec_helper'
|
2020-05-24 23:13:21 +05:30
|
|
|
require 'rubocop'
|
|
|
|
require 'rubocop/rspec/support'
|
|
|
|
require_relative '../../../../rubocop/cop/gitlab/change_timzone'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe RuboCop::Cop::Gitlab::ChangeTimezone do
|
2020-05-24 23:13:21 +05:30
|
|
|
include CopHelper
|
|
|
|
|
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
|
|
|
context 'Time.zone=' do
|
|
|
|
it 'registers an offense with no 2nd argument' do
|
2020-06-23 00:09:42 +05:30
|
|
|
expect_offense(<<~PATTERN)
|
2020-05-24 23:13:21 +05:30
|
|
|
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
|