Skip to content

Commit 39356d5

Browse files
committed
Fix migration date issues when running tests
1 parent 4c2eeee commit 39356d5

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

config/application.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ class Application < Rails::Application
4343

4444
config.load_defaults 7.2
4545

46-
if config.respond_to?(:active_record)
47-
# Timecop in tests followed by db interaction causes a ActiveRecord::InvalidMigrationTimestampError
48-
# due to the current time (set by timecop) being less than the migration timestamp.
49-
config.active_record.validate_migration_timestamps = false
50-
end
51-
5246
config.eager_load = false
5347
end
5448
end

spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@
1212
end
1313

1414
before(:each) do
15-
Timecop.freeze(Time.parse('Jul 15, 2022 12:33:40.000000000 GMT'))
1615
subject.datastore['VERBOSE'] = true
1716
allow(driver).to receive(:input).and_return(driver_input)
1817
allow(driver).to receive(:output).and_return(driver_output)
1918
subject.init_ui(driver_input, driver_output)
2019
end
2120

22-
after do
23-
Timecop.return
24-
end
25-
2621
describe '#run' do
2722
context 'when forging golden tickets' do
2823
it 'generates a golden ticket' do
@@ -36,7 +31,11 @@
3631
subject.datastore['EXTRA_SIDS'] = ' S-1-18-1, S-1-5-21-1266190811-2419310613-1856291569-519, '
3732
subject.datastore['SessionKey'] = 'A' * 16
3833

39-
subject.run
34+
expect(framework.db.active).to be(true)
35+
Timecop.freeze(Time.parse('Jul 15, 2022 12:33:40.000000000 GMT')) do
36+
subject.run
37+
end
38+
4039

4140
ticket_save_path = @output.join("\n")[/Cache ticket saved to (.*)$/, 1]
4241
expect(@output.join("\n")).to match_table <<~TABLE

spec/support/shared/contexts/msf/db_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
before(:example) do
1919
# already connected due to use_transactional_fixtures, but need some of the side-effects of #connect
20-
db_manager.workspace = db_manager.default_workspace
2120
allow(db_manager).to receive(:active).and_return(active)
21+
db_manager.workspace = db_manager.default_workspace
2222
end
2323
end

0 commit comments

Comments
 (0)