From 98f926d53d4982490e04c8f2b8bb9a24e4afb676 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sun, 29 Jan 2017 10:43:00 -0700 Subject: [PATCH] Clean up TerminalSession constructor a bit --- spec/terminal_session.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/terminal_session.rb b/spec/terminal_session.rb index 733728b..bbadb9a 100644 --- a/spec/terminal_session.rb +++ b/spec/terminal_session.rb @@ -3,8 +3,17 @@ require 'securerandom' class TerminalSession ZSH_BIN = ENV['TEST_ZSH_BIN'] || 'zsh' - def initialize(width: 80, height: 24, prompt: '', term: 'xterm-256color') - tmux_command("new-session -d -x #{width} -y #{height} 'PS1=#{prompt} TERM=#{term} #{ZSH_BIN} -f'") + def initialize(opts = {}) + opts = { + width: 80, + height: 24, + prompt: '', + term: 'xterm-256color', + zsh_bin: ZSH_BIN + }.merge(opts) + + cmd="PS1=#{opts[:prompt]} TERM=#{opts[:term]} #{ZSH_BIN} -f" + tmux_command("new-session -d -x #{opts[:width]} -y #{opts[:height]} '#{cmd}'") end def run_command(command)