diff --git a/lib/mspec/commands/mspec-run.rb b/lib/mspec/commands/mspec-run.rb index 4d8f4d9..064c177 100644 --- a/lib/mspec/commands/mspec-run.rb +++ b/lib/mspec/commands/mspec-run.rb @@ -32,6 +32,7 @@ def options(argv = ARGV) options.chdir options.prefix options.configure { |f| load f } + options.env options.randomize options.repeat options.pretend diff --git a/lib/mspec/utils/options.rb b/lib/mspec/utils/options.rb index 3b5962d..23cf915 100644 --- a/lib/mspec/utils/options.rb +++ b/lib/mspec/utils/options.rb @@ -204,6 +204,13 @@ def configure(&block) "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 @@ def debug def all configure {} + env targets formatters filters