summaryrefslogtreecommitdiff
path: root/spec/bundler/support
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-10-05 14:16:57 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-10-18 16:33:15 +0900
commite956caea88b67cc1a1b42b95327190c63d45888a (patch)
treedfa19d53f00c2beb53547687a6a72a2ac9ace395 /spec/bundler/support
parent56ad79694ba18789cb26a85dd693d51d96a092c3 (diff)
downloadruby-e956caea88b67cc1a1b42b95327190c63d45888a.tar.gz
[rubygems/rubygems] Extract matcher for slow perf spec
https://github.com/rubygems/rubygems/commit/1c0eb63c6a
Diffstat (limited to 'spec/bundler/support')
-rw-r--r--spec/bundler/support/matchers.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index ce6b216619..8b22e7dbc3 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -97,6 +97,18 @@ module Spec
end
end
+ RSpec::Matchers.define :take_less_than do |seconds|
+ match do |actual|
+ start_time = Time.now
+
+ actual.call
+
+ (Time.now - start_time).to_f < seconds
+ end
+
+ supports_block_expectations
+ end
+
define_compound_matcher :read_as, [exist] do |file_contents|
diffable