-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathos.rb
More file actions
27 lines (22 loc) · 588 Bytes
/
os.rb
File metadata and controls
27 lines (22 loc) · 588 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true
require "rbconfig"
module RSpec
module Helpers
module OS
private
def with_operating_system(os, &blk)
result = case host_os = RbConfig::CONFIG["host_os"]
when /linux/ then :linux
when /darwin/ then :macos
when /win32|mingw|bccwin|cygwin/ then :windows
else
raise "unknown OS: `#{host_os}'"
end
blk.call if result == os
end
end
end
end
RSpec.configure do |config|
config.include(RSpec::Helpers::OS)
end