Add spec directory (yes, it currently sucks)

This commit is contained in:
Rémi Prévost 2011-10-08 11:50:17 -04:00
parent 208e3a2263
commit dd8be86f8e
4 changed files with 48 additions and 2 deletions

13
spec/examples/layouts.yml Normal file
View File

@ -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

13
spec/layout.rb Normal file
View File

@ -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

17
spec/spec_helper.rb Normal file
View File

@ -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

View File

@ -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