debian-mirror-gitlab/spec/rubocop/cop/gitlab/change_timezone_spec.rb

22 lines
628 B
Ruby
Raw Normal View History

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'
2020-07-28 23:09:34 +05:30
RSpec.describe RuboCop::Cop::Gitlab::ChangeTimezone, type: :rubocop 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