diff --git a/spec/examples/layouts.yml b/spec/examples/layouts.yml new file mode 100644 index 0000000..b87748f --- /dev/null +++ b/spec/examples/layouts.yml @@ -0,0 +1,13 @@ +# Simple two windows layout +two-windows: + 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 diff --git a/spec/layout.rb b/spec/layout.rb new file mode 100644 index 0000000..571d772 --- /dev/null +++ b/spec/layout.rb @@ -0,0 +1,13 @@ +require File.join(File.dirname(__FILE__), "spec_helper.rb") + +describe Teamocil::Layout do + context "initializing" do + + it "create two windows" do # {{{ + layout = Teamocil::Layout.new(examples["two-windows"], {}) + commands = layout.generate_commands + commands.grep(/new-window/).length.should be 2 + end # }}} + + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..272f79c --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,17 @@ +$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) + +require 'yaml' +require 'teamocil' + +module Helpers + + def examples # {{{ + return @@examples if defined?(@@examples) + @@examples = YAML.load_file(File.join(File.dirname(__FILE__), "examples/layouts.yml")) + end # }}} + +end + +RSpec.configure do |c| + c.include Helpers +end diff --git a/teamocil.gemspec b/teamocil.gemspec index a881438..58e6a29 100644 --- a/teamocil.gemspec +++ b/teamocil.gemspec @@ -7,7 +7,10 @@ spec = Gem::Specification.new do |s| s.homepage = "http://github.com/remiprev/teamocil" s.summary = "Easy window and split layouts for tmux" s.description = "Teamocil helps you set up window and splits layouts for tmux using YAML configuration files." - s.files = Dir["lib/**/*.rb", "README.mkd", "LICENSE", "bin/*"] + s.files = Dir["lib/**/*.rb", "README.mkd", "LICENSE", "bin/*", "spec/**/*.rb"] s.require_path = "lib" - s.executables << 'teamocil' + s.executables << "teamocil" + + s.add_development_dependency("rspec") + end