Sha256: 1e6f624f0f0f5193b9a32bbcea1fbf3c9e181bddea73e27de1f138b95145a2b8

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

class TabbySpecBlog < Tabby::Base
  basedir "~/Dev/Blog"
  def foo
    exec "whoami"
    exec "pwd"
  end
end

describe Tabby::Base do
  before do
    Tempfile.stub(:new).and_return(FakeFile.new)
    FakeFS.deactivate!
  end

  subject { TabbySpecBlog.new }

  it "should set a base directory" do
    subject.basedir.should == "~/Dev/Blog"
  end

  it "should queue commands to be executed" do
    subject.exec("ls")
    subject.commands.should include("write text \"ls\"")
  end

  it "should call all tab methods" do
    subject.should_receive(:foo)
    subject.call
  end

  it "should create actual iTerm2 tab before each method call" do
    subject.call
    subject.template.should match /launch session "Default"/
  end

  it "should set the title" do
    subject.call
    subject.template.should match /set name to "foo"/
  end

  it "should change directory into the base directory" do
    subject.call
    subject.template.should match %r{write text "cd ~/Dev/Blog"}
  end

  it "should execute all commands" do
    subject.call
    subject.template.should match /write text "whoami"/
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
tabby2-0.3.0 spec/tabby/base_spec.rb
tabby2-0.2.1 spec/tabby/base_spec.rb
tabby-0.1.0 spec/tabby/base_spec.rb