File: spec_helper.rb

package info (click to toggle)
tmuxinator 3.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 548 kB
  • sloc: ruby: 3,894; sh: 19; makefile: 14
file content (54 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# frozen_string_literal: true

require "pry"

require "tmuxinator"
require "factory_bot"

FactoryBot.find_definitions

# Custom Matchers
require_relative "matchers/pane_matcher"

RSpec.configure do |config|
  config.order = "random"
end

# Copied from minitest.
def capture_io
  require "stringio"

  captured_stdout = StringIO.new
  captured_stderr = StringIO.new

  orig_stdout = $stdout
  orig_stderr = $stderr

  $stdout = captured_stdout
  $stderr = captured_stderr

  yield

  [captured_stdout.string, captured_stderr.string]
ensure
  $stdout = orig_stdout
  $stderr = orig_stderr
end

def tmux_config(options = {})
  standard_options = [
    "assume-paste-time 1",
    "bell-action any",
    "bell-on-alert off",
  ]

  if base_index = options.fetch(:base_index, 1)
    standard_options << "base-index #{base_index}"
  end

  if pane_base_index = options.fetch(:pane_base_index, 1)
    standard_options << "pane-base-index #{pane_base_index}"
  end

  "echo '#{standard_options.join("\n")}'"
end