Improve specs
This commit is contained in:
parent
fb9822064e
commit
a424684c5a
@ -27,7 +27,7 @@ module Teamocil
|
||||
if @layout["session"].nil?
|
||||
windows = @layout["windows"]
|
||||
else
|
||||
output << "tmux rename-session #{@layout["session"]["name"]}" if @layout["session"]["name"]
|
||||
output << "tmux rename-session \"#{@layout["session"]["name"]}\"" if @layout["session"]["name"]
|
||||
windows = @layout["session"]["windows"]
|
||||
end
|
||||
|
||||
|
24
spec/fixtures/layouts.yml
vendored
24
spec/fixtures/layouts.yml
vendored
@ -11,3 +11,27 @@ two-windows:
|
||||
- cmd: "echo 'bar'"
|
||||
- cmd: "echo 'bar again'"
|
||||
width: 50
|
||||
|
||||
# Simple two windows layout in session
|
||||
two-windows-in-a-session:
|
||||
session:
|
||||
name: my-new-session
|
||||
windows:
|
||||
- name: "foo"
|
||||
splits:
|
||||
- cmd: "echo 'foo'"
|
||||
- cmd: "echo 'foo again'"
|
||||
width: 50
|
||||
- name: "bar"
|
||||
splits:
|
||||
- cmd: "echo 'bar'"
|
||||
- cmd: "echo 'bar again'"
|
||||
width: 50
|
||||
four-splits:
|
||||
windows:
|
||||
- name: "foo"
|
||||
splits:
|
||||
- cmd: "echo 1"
|
||||
- cmd: "echo 2"
|
||||
- cmd: "echo 3"
|
||||
- cmd: "echo 4"
|
||||
|
@ -3,10 +3,23 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb")
|
||||
describe Teamocil::Layout do
|
||||
context "initializing" do
|
||||
|
||||
it "create two windows" do # {{{
|
||||
it "creates windows" do # {{{
|
||||
layout = Teamocil::Layout.new(layouts["two-windows"], {})
|
||||
commands = layout.generate_commands
|
||||
commands.grep(/new-window/).length.should be 2
|
||||
commands.grep(/new-window/).length.should == 2
|
||||
end # }}}
|
||||
|
||||
it "renames the current session" do # {{{
|
||||
layout = Teamocil::Layout.new(layouts["two-windows-in-a-session"], {})
|
||||
commands = layout.generate_commands
|
||||
commands.grep(/rename-session/).first.should == "tmux rename-session \"my-new-session\""
|
||||
commands.grep(/new-window/).length.should == 2
|
||||
end # }}}
|
||||
|
||||
it "creates splits" do # {{{
|
||||
layout = Teamocil::Layout.new(layouts["four-splits"], {})
|
||||
commands = layout.generate_commands
|
||||
commands.grep(/split-window/).length.should == 3
|
||||
end # }}}
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user