summaryrefslogtreecommitdiff
path: root/spec/mspec/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-11-27 14:22:40 +0900
committerHiroshi SHIBATA <[email protected]>2024-11-27 16:45:10 +0900
commit26aebdb6d6ada732bf0aadd9062e65291c7cc413 (patch)
tree7d3057f3bf97123a9c6261ce1c2947337760bfaf /spec/mspec/lib
parent671e6eb6447575e6acfd0b52e6ac9034c6611c0c (diff)
Added --env option to mspec for test-bundled-gems
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12179
Diffstat (limited to 'spec/mspec/lib')
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-run.rb1
-rw-r--r--spec/mspec/lib/mspec/utils/options.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/spec/mspec/lib/mspec/commands/mspec-run.rb b/spec/mspec/lib/mspec/commands/mspec-run.rb
index 4d8f4d9984..064c177d69 100644
--- a/spec/mspec/lib/mspec/commands/mspec-run.rb
+++ b/spec/mspec/lib/mspec/commands/mspec-run.rb
@@ -32,6 +32,7 @@ class MSpecRun < MSpecScript
options.chdir
options.prefix
options.configure { |f| load f }
+ options.env
options.randomize
options.repeat
options.pretend
diff --git a/spec/mspec/lib/mspec/utils/options.rb b/spec/mspec/lib/mspec/utils/options.rb
index 3b5962dbe6..23cf915e66 100644
--- a/spec/mspec/lib/mspec/utils/options.rb
+++ b/spec/mspec/lib/mspec/utils/options.rb
@@ -204,6 +204,13 @@ class MSpecOptions
"Load FILE containing configuration options", &block)
end
+ def env
+ on("--env", "KEY=VALUE", "Set environment variable") do |env|
+ key, value = env.split('=', 2)
+ ENV[key] = value
+ end
+ end
+
def targets
on("-t", "--target", "TARGET",
"Implementation to run the specs, where TARGET is:") do |t|
@@ -484,6 +491,7 @@ class MSpecOptions
def all
configure {}
+ env
targets
formatters
filters