Add more specs, yeah!

This commit is contained in:
Rémi Prévost 2011-10-23 20:10:16 -04:00
parent e4e9f2d1cd
commit cbed2f3e5b
2 changed files with 35 additions and 4 deletions

View File

@ -13,6 +13,7 @@ two-windows:
- cmd: - cmd:
- "echo 'bar'" - "echo 'bar'"
- "echo 'bar in an array'" - "echo 'bar in an array'"
target: bottom-right
- cmd: "echo 'bar again'" - cmd: "echo 'bar again'"
width: 50 width: 50

View File

@ -2,15 +2,19 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb")
describe Teamocil::Layout do describe Teamocil::Layout do
context "initializing" do
end
context "compiling" do context "compiling" do
before :each do # {{{ before do # {{{
@layout = Teamocil::Layout.new(layouts["two-windows"], {}) @layout = Teamocil::Layout.new(layouts["two-windows"], {})
end # }}} end # }}}
it "creates windows" do # {{{
session = @layout.compile!
session.windows.each do |window|
window.should be_an_instance_of Teamocil::Layout::Window
end
end # }}}
it "creates windows with names" do # {{{ it "creates windows with names" do # {{{
session = @layout.compile! session = @layout.compile!
session.windows[0].name.should == "foo" session.windows[0].name.should == "foo"
@ -23,6 +27,13 @@ describe Teamocil::Layout do
session.windows[1].root.should == "/bar" session.windows[1].root.should == "/bar"
end # }}} end # }}}
it "creates splits" do # {{{
session = @layout.compile!
session.windows.first.splits.each do |split|
split.should be_an_instance_of Teamocil::Layout::Split
end
end # }}}
it "creates splits with dimensions" do # {{{ it "creates splits with dimensions" do # {{{
session = @layout.compile! session = @layout.compile!
session.windows.first.splits[0].width.should == nil session.windows.first.splits[0].width.should == nil
@ -57,5 +68,24 @@ describe Teamocil::Layout do
session.windows.first.filters["after"].last.should == "echo second after filter" session.windows.first.filters["after"].last.should == "echo second after filter"
end # }}} end # }}}
it "should handle blank filters" do # {{{
session = @layout.compile!
session.windows.first.filters.should have_key "after"
session.windows.first.filters.should have_key "before"
session.windows.first.filters["after"].should be_empty
session.windows.first.filters["before"].should be_empty
end # }}}
it "should handle splits without a target" do # {{{
session = @layout.compile!
session.windows.last.splits.last.target.should == nil
end # }}}
it "should handle splits with a target" do # {{{
session = @layout.compile!
session.windows.last.splits.first.target.should == "bottom-right"
end # }}}
end end
end end