Skip to content

Commit

Permalink
Remove usage of OpenStruct
Browse files Browse the repository at this point in the history
ostruct will be a bundled gem in the future and would need to be specified as a dependency
  • Loading branch information
benedikt committed Nov 8, 2024
1 parent d010739 commit 15301bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/flipper/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
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)
allow(stderr).to receive(:tty?).and_return(true)
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
Expand All @@ -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
Expand Down

0 comments on commit 15301bf

Please sign in to comment.