Add a case to check session handling

This commit is contained in:
Rémi Prévost 2011-10-23 20:42:48 -04:00
parent f2926471bd
commit 68d07cd897
3 changed files with 17 additions and 1 deletions

View File

@ -44,7 +44,8 @@ module Teamocil
@root = attrs["root"] @root = attrs["root"]
@options = attrs["options"] @options = attrs["options"]
@filters = attrs["filters"] @filters = attrs["filters"]
@splits = attrs["splits"].each_with_index.map { |split, index| Split.new(self, index, split) } @splits = attrs["splits"] || []
@splits = @splits.each_with_index.map { |split, index| Split.new(self, index, split) }
@index = index @index = index
@session = session @session = session

View File

@ -33,3 +33,11 @@ two-windows-with-filters:
- cmd: "echo 'foo'" - cmd: "echo 'foo'"
- cmd: "echo 'foo again'" - cmd: "echo 'foo again'"
width: 50 width: 50
three-windows-within-a-session:
session:
name: "my awesome session"
windows:
- name: "first window"
- name: "second window"
- name: "third window"

View File

@ -86,6 +86,13 @@ describe Teamocil::Layout do
session.windows.last.splits.first.target.should == "bottom-right" session.windows.last.splits.first.target.should == "bottom-right"
end # }}} end # }}}
it "should handle windows within a session" do # {{{
layout = Teamocil::Layout.new(layouts["three-windows-within-a-session"], {})
session = layout.compile!
session.windows.length.should == 3
session.name.should == "my awesome session"
end # }}}
end end
end end