From cbed2f3e5be3bdabd134f51e0361da3e6c2ccb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81mi=20Pre=CC=81vost?= Date: Sun, 23 Oct 2011 20:10:16 -0400 Subject: [PATCH] Add more specs, yeah! --- spec/fixtures/layouts.yml | 1 + spec/layout_spec.rb | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/spec/fixtures/layouts.yml b/spec/fixtures/layouts.yml index 6bedc5c..f70f880 100644 --- a/spec/fixtures/layouts.yml +++ b/spec/fixtures/layouts.yml @@ -13,6 +13,7 @@ two-windows: - cmd: - "echo 'bar'" - "echo 'bar in an array'" + target: bottom-right - cmd: "echo 'bar again'" width: 50 diff --git a/spec/layout_spec.rb b/spec/layout_spec.rb index 89a1896..7ad3365 100644 --- a/spec/layout_spec.rb +++ b/spec/layout_spec.rb @@ -2,15 +2,19 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb") describe Teamocil::Layout do - context "initializing" do - end - context "compiling" do - before :each do # {{{ + before do # {{{ @layout = Teamocil::Layout.new(layouts["two-windows"], {}) 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 # {{{ session = @layout.compile! session.windows[0].name.should == "foo" @@ -23,6 +27,13 @@ describe Teamocil::Layout do session.windows[1].root.should == "/bar" 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 # {{{ session = @layout.compile! 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" 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