File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require_relative "spec_helper"
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ describe Hooks ::VERSION do
4+ it "has a version number" do
5+ expect ( Hooks ::VERSION ) . not_to be nil
6+ expect ( Hooks ::VERSION ) . to match ( /^\d +\. \d +\. \d +$/ )
7+ end
8+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "simplecov"
4+ require "simplecov-erb"
5+ require "rspec"
6+ require "time"
7+
8+ TIME_MOCK = "2025-01-01T00:00:00Z"
9+
10+ COV_DIR = File . expand_path ( "../coverage" , File . dirname ( __FILE__ ) )
11+
12+ SimpleCov . root File . expand_path ( ".." , File . dirname ( __FILE__ ) )
13+ SimpleCov . coverage_dir COV_DIR
14+
15+ SimpleCov . minimum_coverage 100
16+
17+ SimpleCov . at_exit do
18+ File . write ( "#{ COV_DIR } /total-coverage.txt" , SimpleCov . result . covered_percent )
19+ SimpleCov . result . format!
20+ end
21+
22+ SimpleCov . start do
23+ add_filter "config/"
24+ add_filter "spec/"
25+ add_filter "vendor/gems/"
26+ end
27+
28+ # Require all Ruby files in the lib directory
29+ Dir . glob ( File . expand_path ( "../lib/**/*.rb" , __dir__ ) ) . each do |file |
30+ require file
31+ end
32+
33+ RSpec . configure do |config |
34+ config . before ( :each ) do
35+ fake_time = Time . parse ( TIME_MOCK )
36+ allow ( Time ) . to receive ( :now ) . and_return ( fake_time )
37+ allow ( Time ) . to receive ( :new ) . and_return ( fake_time )
38+ allow ( Time ) . to receive ( :iso8601 ) . and_return ( fake_time )
39+ allow ( fake_time ) . to receive ( :utc ) . and_return ( fake_time )
40+ allow ( fake_time ) . to receive ( :iso8601 ) . and_return ( TIME_MOCK )
41+
42+ allow ( Kernel ) . to receive ( :sleep )
43+ allow_any_instance_of ( Kernel ) . to receive ( :sleep )
44+ allow_any_instance_of ( Object ) . to receive ( :sleep )
45+ end
46+ end
You can’t perform that action at this time.
0 commit comments