Extract CliTestCase

This commit is contained in:
David Heinemeier Hansson
2023-02-02 15:37:41 +01:00
parent 08908c3925
commit f88685a525
5 changed files with 30 additions and 49 deletions

24
test/cli/cli_test_case.rb Normal file
View File

@@ -0,0 +1,24 @@
require "test_helper"
require "active_support/testing/stream"
require "mrsk/cli"
class CliTestCase < ActiveSupport::TestCase
include ActiveSupport::Testing::Stream
setup do
ENV["VERSION"] = "999"
ENV["RAILS_MASTER_KEY"] = "123"
ENV["MYSQL_ROOT_PASSWORD"] = "secret123"
end
teardown do
ENV.delete("RAILS_MASTER_KEY")
ENV.delete("MYSQL_ROOT_PASSWORD")
ENV.delete("VERSION")
end
private
def stdouted
capture(:stdout) { yield }.strip
end
end