From 15301bf2674facefd6fbdc70ddfc2ad31578bf61 Mon Sep 17 00:00:00 2001 From: Benedikt Deicke Date: Fri, 8 Nov 2024 11:16:48 +0100 Subject: [PATCH] Remove usage of OpenStruct ostruct will be a bundled gem in the future and would need to be specified as a dependency --- spec/flipper/cli_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/flipper/cli_spec.rb b/spec/flipper/cli_spec.rb index 7be999b6..1b28f1a7 100644 --- a/spec/flipper/cli_spec.rb +++ b/spec/flipper/cli_spec.rb @@ -5,6 +5,8 @@ let(:stderr) { StringIO.new } let(:cli) { Flipper::CLI.new(stdout: stdout, stderr: stderr) } + Result = Struct.new(:status, :stdout, :stderr, keyword_init: true) + before do # Prentend stdout/stderr a TTY to test colorization allow(stdout).to receive(:tty?).and_return(true) @@ -12,7 +14,7 @@ end # Infer the command from the description - subject(:argv) do + let(:argv) do descriptions = self.class.parent_groups.map {|g| g.metadata[:description_args] }.reverse.flatten.drop(1) descriptions.map { |arg| Shellwords.split(arg) }.flatten end @@ -26,7 +28,7 @@ status = e.status end - OpenStruct.new(status: status, stdout: stdout.string, stderr: stderr.string) + Result.new(status: status, stdout: stdout.string, stderr: stderr.string) end before do