Skip to content

Commit

Permalink
automatically detect timecop when configuring CI mode and set time_no…
Browse files Browse the repository at this point in the history
…w_provider to Time.now_without_mock_time
  • Loading branch information
anmarchenko committed May 29, 2024
1 parent cbf442b commit 37e4658
Show file tree
Hide file tree
Showing 19 changed files with 1,116 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def self.with_selenium_gem(selenium_versions: 4, capybara_versions: 3)
end
end

def self.with_timecop_gem(timecop_versions: 0)
Array(timecop_versions).each do |timecop_v|
appraise "timecop-#{timecop_v}" do
gem "timecop", "~> #{timecop_v}"

gem "minitest", "~> 5"
end
end
end

ruby_version = Gem::Version.new(RUBY_ENGINE_VERSION)
major, minor, = ruby_version.segments

Expand All @@ -161,6 +171,7 @@ with_minitest_shoulda_context_gem if ruby_version >= Gem::Version.new("3.1")
with_active_support_gem(versions: 4..7)
with_knapsack_pro_rspec_gem
with_selenium_gem if ruby_version >= Gem::Version.new("3.0")
with_timecop_gem

ruby_runtime = "#{RUBY_ENGINE}-#{major}.#{minor}"

Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ TEST_METADATA = {
},
"selenium" => {
"selenium-4-capybara-3" => "❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby"
},
"timecop" => {
"timecop-0" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby"
}
}

Expand Down Expand Up @@ -140,7 +143,8 @@ namespace :spec do
:ci_queue_rspec,
:knapsack_rspec,
:knapsack_rspec_go,
:selenium
:selenium,
:timecop
].each do |contrib|
desc "" # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(contrib) do |t, args|
Expand Down
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ target :lib do
library "bundler"
library "selenium-webdriver"
library "capybara"
library "timecop"
end
31 changes: 31 additions & 0 deletions gemfiles/jruby_9.4_timecop_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "timecop", "~> 0"
gem "standard", "~> 1.31"
gem "yard"
gem "webrick"
gem "pimpmychangelog", ">= 0.1.2"
gem "simplecov"
gem "simplecov-cobertura", "~> 2.1.0"
gem "minitest", "~> 5"

group :check do

end

group :development do

end

gemspec path: "../"
142 changes: 142 additions & 0 deletions gemfiles/jruby_9.4_timecop_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
PATH
remote: ..
specs:
datadog-ci (1.0.0.beta6)
datadog (~> 2.0.0.beta2)
msgpack

GEM
remote: https://rubygems.org/
specs:
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
climate_control (1.2.0)
coderay (1.1.3)
datadog (2.0.0.rc1)
debase-ruby_core_source (= 3.3.1)
libdatadog (~> 9.0.0.1.0)
libddwaf (~> 1.14.0.0.0)
msgpack
debase-ruby_core_source (3.3.1)
diff-lcs (1.5.1)
docile (1.4.0)
ffi (1.16.3-java)
json (2.7.2-java)
language_server-protocol (3.17.0.3)
libdatadog (9.0.0.1.0)
libddwaf (1.14.0.0.0-java)
ffi (~> 1.0)
lint_roller (1.1.0)
method_source (1.1.0)
minitest (5.23.1)
msgpack (1.7.2-java)
os (1.1.4)
parallel (1.24.0)
parser (3.3.1.0)
ast (~> 2.4.1)
racc
pimpmychangelog (0.1.3)
pry (0.14.2-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
racc (1.8.0-java)
rainbow (3.1.1)
rake (13.2.1)
rake-compiler (1.2.7)
rake
regexp_parser (2.9.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
spoon (0.0.6)
ffi
standard (1.36.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.63.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
strscan (3.1.0-java)
thor (1.3.1)
timecop (0.9.8)
unicode-display_width (2.5.0)
webrick (1.8.1)
yard (0.9.36)

PLATFORMS
universal-java-11

DEPENDENCIES
appraisal
climate_control
datadog-ci!
minitest (~> 5)
os
pimpmychangelog (>= 0.1.2)
pry
rake
rake-compiler
rspec
rspec-collection_matchers
rspec_junit_formatter
simplecov
simplecov-cobertura (~> 2.1.0)
standard (~> 1.31)
timecop (~> 0)
webrick
yard

BUNDLED WITH
2.3.26
32 changes: 32 additions & 0 deletions gemfiles/ruby_2.7_timecop_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "pry"
gem "rake"
gem "os"
gem "rake-compiler"
gem "climate_control"
gem "rspec"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "timecop", "~> 0"
gem "standard", "~> 1.31"
gem "yard"
gem "redcarpet"
gem "webrick"
gem "pimpmychangelog", ">= 0.1.2"
gem "simplecov"
gem "simplecov-cobertura", "~> 2.1.0"
gem "minitest", "~> 5"

group :check do

end

group :development do

end

gemspec path: "../"
Loading

0 comments on commit 37e4658

Please sign in to comment.