mirror of
https://github.com/tmuxinator/tmuxinator.git
synced 2026-03-11 18:24:23 -05:00
Update to RSpec 3.0.
This commit is contained in:
@@ -4,10 +4,10 @@ describe Tmuxinator::Cli do
|
||||
|
||||
before do
|
||||
ARGV.clear
|
||||
Kernel.stub(:system)
|
||||
FileUtils.stub(:copy_file)
|
||||
FileUtils.stub(:rm)
|
||||
FileUtils.stub(:remove_dir)
|
||||
allow(Kernel).to receive(:system)
|
||||
allow(FileUtils).to receive(:copy_file)
|
||||
allow(FileUtils).to receive(:rm)
|
||||
allow(FileUtils).to receive(:remove_dir)
|
||||
end
|
||||
|
||||
context "no arguments" do
|
||||
@@ -20,7 +20,7 @@ describe Tmuxinator::Cli do
|
||||
describe "#completions" do
|
||||
before do
|
||||
ARGV.replace(["completions", "start"])
|
||||
Tmuxinator::Config.stub(:configs => ["test.yml"])
|
||||
allow(Tmuxinator::Config).to receive_messages(:configs => ["test.yml"])
|
||||
end
|
||||
|
||||
it "gets completions" do
|
||||
@@ -43,9 +43,9 @@ describe Tmuxinator::Cli do
|
||||
describe "#start" do
|
||||
before do
|
||||
ARGV.replace(["start", "foo"])
|
||||
Tmuxinator::Config.stub(:validate => project)
|
||||
Tmuxinator::Config.stub(:version => 1.9)
|
||||
Kernel.stub(:exec)
|
||||
allow(Tmuxinator::Config).to receive_messages(:validate => project)
|
||||
allow(Tmuxinator::Config).to receive_messages(:version => 1.9)
|
||||
allow(Kernel).to receive(:exec)
|
||||
end
|
||||
|
||||
context "no deprecations" do
|
||||
@@ -59,7 +59,7 @@ describe Tmuxinator::Cli do
|
||||
|
||||
context "deprecations" do
|
||||
before do
|
||||
$stdin.stub(:getc => "y")
|
||||
allow($stdin).to receive_messages(:getc => "y")
|
||||
end
|
||||
|
||||
let(:project) { FactoryGirl.build(:project_with_deprecations) }
|
||||
@@ -76,12 +76,12 @@ describe Tmuxinator::Cli do
|
||||
|
||||
before do
|
||||
ARGV.replace(["new", "test"])
|
||||
File.stub(:open) { |&block| block.yield file }
|
||||
allow(File).to receive(:open) { |&block| block.yield file }
|
||||
end
|
||||
|
||||
context "existing project doesn't exist" do
|
||||
before do
|
||||
Tmuxinator::Config.stub(:exists? => false)
|
||||
allow(Tmuxinator::Config).to receive_messages(:exists? => false)
|
||||
end
|
||||
|
||||
it "creates a new tmuxinator project file" do
|
||||
@@ -92,7 +92,7 @@ describe Tmuxinator::Cli do
|
||||
|
||||
context "files exists" do
|
||||
before do
|
||||
File.stub(:exists? => true)
|
||||
allow(File).to receive_messages(:exists? => true)
|
||||
end
|
||||
|
||||
it "just opens the file" do
|
||||
@@ -105,12 +105,12 @@ describe Tmuxinator::Cli do
|
||||
describe "#copy" do
|
||||
before do
|
||||
ARGV.replace(["copy", "foo", "bar"])
|
||||
Tmuxinator::Config.stub(:exists?) { true }
|
||||
allow(Tmuxinator::Config).to receive(:exists?) { true }
|
||||
end
|
||||
|
||||
context "new project already exists" do
|
||||
before do
|
||||
Thor::LineEditor.stub(:readline => "y")
|
||||
allow(Thor::LineEditor).to receive_messages(:readline => "y")
|
||||
end
|
||||
|
||||
it "prompts user to confirm overwrite" do
|
||||
@@ -126,7 +126,7 @@ describe Tmuxinator::Cli do
|
||||
|
||||
context "existing project doens't exist" do
|
||||
before do
|
||||
Tmuxinator::Config.stub(:exists?) { false }
|
||||
allow(Tmuxinator::Config).to receive(:exists?) { false }
|
||||
end
|
||||
|
||||
it "exit with error code" do
|
||||
@@ -140,7 +140,7 @@ describe Tmuxinator::Cli do
|
||||
|
||||
before do
|
||||
ARGV.replace(["debug", "foo"])
|
||||
Tmuxinator::Config.stub(:validate => project)
|
||||
allow(Tmuxinator::Config).to receive_messages(:validate => project)
|
||||
end
|
||||
|
||||
it "renders the project" do
|
||||
@@ -152,12 +152,12 @@ describe Tmuxinator::Cli do
|
||||
describe "#delete" do
|
||||
before do
|
||||
ARGV.replace(["delete", "foo"])
|
||||
Thor::LineEditor.stub(:readline => "y")
|
||||
allow(Thor::LineEditor).to receive_messages(:readline => "y")
|
||||
end
|
||||
|
||||
context "project exists" do
|
||||
before do
|
||||
Tmuxinator::Config.stub(:exists?) { true }
|
||||
allow(Tmuxinator::Config).to receive(:exists?) { true }
|
||||
end
|
||||
|
||||
it "deletes the project" do
|
||||
@@ -168,7 +168,7 @@ describe Tmuxinator::Cli do
|
||||
|
||||
context "project doesn't exist" do
|
||||
before do
|
||||
Thor::LineEditor.stub(:readline => "y")
|
||||
allow(Thor::LineEditor).to receive_messages(:readline => "y")
|
||||
end
|
||||
|
||||
it "exits with error message" do
|
||||
@@ -180,7 +180,7 @@ describe Tmuxinator::Cli do
|
||||
describe "#implode" do
|
||||
before do
|
||||
ARGV.replace(["implode"])
|
||||
Thor::LineEditor.stub(:readline => "y")
|
||||
allow(Thor::LineEditor).to receive_messages(:readline => "y")
|
||||
end
|
||||
|
||||
it "confirms deletion of all projects" do
|
||||
@@ -197,7 +197,7 @@ describe Tmuxinator::Cli do
|
||||
describe "#list" do
|
||||
before do
|
||||
ARGV.replace(["list"])
|
||||
Dir.stub(:[] => ["/path/to/project.yml"])
|
||||
allow(Dir).to receive_messages(:[] => ["/path/to/project.yml"])
|
||||
end
|
||||
|
||||
it "lists all projects" do
|
||||
@@ -222,9 +222,9 @@ describe Tmuxinator::Cli do
|
||||
end
|
||||
|
||||
it "checks requirements" do
|
||||
Tmuxinator::Config.should_receive(:installed?)
|
||||
Tmuxinator::Config.should_receive(:editor?)
|
||||
Tmuxinator::Config.should_receive(:shell?)
|
||||
expect(Tmuxinator::Config).to receive(:installed?)
|
||||
expect(Tmuxinator::Config).to receive(:editor?)
|
||||
expect(Tmuxinator::Config).to receive(:shell?)
|
||||
capture_io { cli.start }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,28 +24,28 @@ describe Tmuxinator::Config do
|
||||
|
||||
context "when the file exists" do
|
||||
before do
|
||||
File.stub(:exists?).with(Tmuxinator::Config.default) { true }
|
||||
allow(File).to receive(:exists?).with(Tmuxinator::Config.default) { true }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.default?).to be_true
|
||||
expect(Tmuxinator::Config.default?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context "when the file doesn't exist" do
|
||||
before do
|
||||
File.stub(:exists?).with(Tmuxinator::Config.default) { false }
|
||||
allow(File).to receive(:exists?).with(Tmuxinator::Config.default) { false }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.default?).to be_false
|
||||
expect(Tmuxinator::Config.default?).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#configs" do
|
||||
before do
|
||||
Dir.stub(:[] => ["test.yml"])
|
||||
allow(Dir).to receive_messages(:[] => ["test.yml"])
|
||||
end
|
||||
|
||||
it "gets a list of all projects" do
|
||||
@@ -56,21 +56,21 @@ describe Tmuxinator::Config do
|
||||
describe "#installed?" do
|
||||
context "tmux is installed" do
|
||||
before do
|
||||
Kernel.stub(:system) { true }
|
||||
allow(Kernel).to receive(:system) { true }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.installed?).to be_true
|
||||
expect(Tmuxinator::Config.installed?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context "tmux is not installed" do
|
||||
before do
|
||||
Kernel.stub(:system) { false }
|
||||
allow(Kernel).to receive(:system) { false }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.installed?).to be_false
|
||||
expect(Tmuxinator::Config.installed?).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -78,21 +78,21 @@ describe Tmuxinator::Config do
|
||||
describe "#editor?" do
|
||||
context "$EDITOR is set" do
|
||||
before do
|
||||
ENV.stub(:[]).with("EDITOR") { "vim" }
|
||||
allow(ENV).to receive(:[]).with("EDITOR") { "vim" }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.editor?).to be_true
|
||||
expect(Tmuxinator::Config.editor?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context "$EDITOR is not set" do
|
||||
before do
|
||||
ENV.stub(:[]).with("EDITOR") { nil }
|
||||
allow(ENV).to receive(:[]).with("EDITOR") { nil }
|
||||
end
|
||||
|
||||
it "returns false" do
|
||||
expect(Tmuxinator::Config.editor?).to be_false
|
||||
expect(Tmuxinator::Config.editor?).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -100,33 +100,33 @@ describe Tmuxinator::Config do
|
||||
describe "#shell?" do
|
||||
context "$SHELL is set" do
|
||||
before do
|
||||
ENV.stub(:[]).with("SHELL") { "vim" }
|
||||
allow(ENV).to receive(:[]).with("SHELL") { "vim" }
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
expect(Tmuxinator::Config.shell?).to be_true
|
||||
expect(Tmuxinator::Config.shell?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context "$SHELL is not set" do
|
||||
before do
|
||||
ENV.stub(:[]).with("SHELL") { nil }
|
||||
allow(ENV).to receive(:[]).with("SHELL") { nil }
|
||||
end
|
||||
|
||||
it "returns false" do
|
||||
expect(Tmuxinator::Config.shell?).to be_false
|
||||
expect(Tmuxinator::Config.shell?).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#exists?" do
|
||||
before do
|
||||
File.stub(:exists? => true)
|
||||
Tmuxinator::Config.stub(:project => "")
|
||||
allow(File).to receive_messages(:exists? => true)
|
||||
allow(Tmuxinator::Config).to receive_messages(:project => "")
|
||||
end
|
||||
|
||||
it "checks if the given project exists" do
|
||||
expect(Tmuxinator::Config.exists?("test")).to be_true
|
||||
expect(Tmuxinator::Config.exists?("test")).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
@@ -135,7 +135,7 @@ describe Tmuxinator::Config do
|
||||
|
||||
before do
|
||||
path = File.expand_path("../../../fixtures/", __FILE__)
|
||||
Tmuxinator::Config.stub(:root => path)
|
||||
allow(Tmuxinator::Config).to receive_messages(:root => path)
|
||||
end
|
||||
|
||||
context "with project yml" do
|
||||
|
||||
@@ -81,8 +81,8 @@ describe Tmuxinator::Project do
|
||||
context "with deprecations" do
|
||||
context "rbenv option is present" do
|
||||
before do
|
||||
project.stub(:rbenv? => true)
|
||||
project.stub_chain(:yaml, :[]).and_return("2.0.0-p247")
|
||||
allow(project).to receive_messages(:rbenv? => true)
|
||||
allow(project).to receive_message_chain(:yaml, :[]).and_return("2.0.0-p247")
|
||||
end
|
||||
|
||||
it "still gets the correct pre_window command" do
|
||||
@@ -92,8 +92,8 @@ describe Tmuxinator::Project do
|
||||
|
||||
context "rvm option is present" do
|
||||
before do
|
||||
project.stub(:rbenv? => false)
|
||||
project.stub_chain(:yaml, :[]).and_return("ruby-2.0.0-p247")
|
||||
allow(project).to receive_messages(:rbenv? => false)
|
||||
allow(project).to receive_message_chain(:yaml, :[]).and_return("ruby-2.0.0-p247")
|
||||
end
|
||||
|
||||
it "still gets the correct pre_window command" do
|
||||
@@ -103,8 +103,8 @@ describe Tmuxinator::Project do
|
||||
|
||||
context "pre_tab is present" do
|
||||
before do
|
||||
project.stub(:rbenv? => false)
|
||||
project.stub(:pre_tab? => true)
|
||||
allow(project).to receive_messages(:rbenv? => false)
|
||||
allow(project).to receive_messages(:pre_tab? => true)
|
||||
end
|
||||
|
||||
it "still gets the correct pre_window command" do
|
||||
@@ -117,7 +117,7 @@ describe Tmuxinator::Project do
|
||||
describe "#socket" do
|
||||
context "socket path is present" do
|
||||
before do
|
||||
project.stub(:socket_path => "/tmp")
|
||||
allow(project).to receive_messages(:socket_path => "/tmp")
|
||||
end
|
||||
|
||||
it "gets the socket path" do
|
||||
@@ -147,7 +147,7 @@ describe Tmuxinator::Project do
|
||||
describe "#tmux_options" do
|
||||
context "no tmux options" do
|
||||
before do
|
||||
project.stub(:tmux_options? => false)
|
||||
allow(project).to receive_messages(:tmux_options? => false)
|
||||
end
|
||||
|
||||
it "returns nothing" do
|
||||
@@ -157,7 +157,7 @@ describe Tmuxinator::Project do
|
||||
|
||||
context "with deprecations" do
|
||||
before do
|
||||
project_with_deprecations.stub(:cli_args? => true)
|
||||
allow(project_with_deprecations).to receive_messages(:cli_args? => true)
|
||||
end
|
||||
|
||||
it "still gets the tmux options" do
|
||||
@@ -168,7 +168,7 @@ describe Tmuxinator::Project do
|
||||
|
||||
describe "#get_pane_base_index" do
|
||||
it "extracts the pane_base_index from tmux_options" do
|
||||
project.stub(show_tmux_options: tmux_config(pane_base_index: 3))
|
||||
allow(project).to receive_messages(show_tmux_options: tmux_config(pane_base_index: 3))
|
||||
|
||||
expect(project.get_pane_base_index).to eq("3")
|
||||
end
|
||||
@@ -176,7 +176,7 @@ describe Tmuxinator::Project do
|
||||
|
||||
describe "#get_base_index" do
|
||||
it "extracts the base index from options" do
|
||||
project.stub(show_tmux_options: tmux_config(base_index: 1))
|
||||
allow(project).to receive_messages(show_tmux_options: tmux_config(base_index: 1))
|
||||
|
||||
expect(project.get_base_index).to eq("1")
|
||||
end
|
||||
@@ -185,8 +185,8 @@ describe Tmuxinator::Project do
|
||||
describe "#base_index" do
|
||||
context "pane base index present" do
|
||||
before do
|
||||
project.stub(:get_pane_base_index => "1")
|
||||
project.stub(:get_base_index => "1")
|
||||
allow(project).to receive_messages(:get_pane_base_index => "1")
|
||||
allow(project).to receive_messages(:get_base_index => "1")
|
||||
end
|
||||
|
||||
it "gets the pane base index" do
|
||||
@@ -196,8 +196,8 @@ describe Tmuxinator::Project do
|
||||
|
||||
context "pane base index no present" do
|
||||
before do
|
||||
project.stub(:get_pane_base_index => nil)
|
||||
project.stub(:get_base_index => "0")
|
||||
allow(project).to receive_messages(:get_pane_base_index => nil)
|
||||
allow(project).to receive_messages(:get_base_index => "0")
|
||||
end
|
||||
|
||||
it "gets the base index" do
|
||||
@@ -215,7 +215,7 @@ describe Tmuxinator::Project do
|
||||
describe "#name?" do
|
||||
context "name is present" do
|
||||
it "returns true" do
|
||||
expect(project.name?).to be_true
|
||||
expect(project.name?).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -223,7 +223,7 @@ describe Tmuxinator::Project do
|
||||
describe "#windows?" do
|
||||
context "windows are present" do
|
||||
it "returns true" do
|
||||
expect(project.windows?).to be_true
|
||||
expect(project.windows?).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -231,7 +231,7 @@ describe Tmuxinator::Project do
|
||||
describe "#root?" do
|
||||
context "root are present" do
|
||||
it "returns true" do
|
||||
expect(project.root?).to be_true
|
||||
expect(project.root?).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ describe Tmuxinator::Window do
|
||||
let(:window) { Tmuxinator::Window.new(yaml, 0, project) }
|
||||
|
||||
before do
|
||||
project.stub(:tmux => "tmux", :name => "test", :base_index => 1)
|
||||
allow(project).to receive_messages(:tmux => "tmux", :name => "test", :base_index => 1)
|
||||
end
|
||||
|
||||
describe "#initialize" do
|
||||
@@ -29,7 +29,7 @@ describe Tmuxinator::Window do
|
||||
let(:pane) { double(:pane) }
|
||||
|
||||
before do
|
||||
Tmuxinator::Pane.stub :new => pane
|
||||
allow(Tmuxinator::Pane).to receive_messages :new => pane
|
||||
end
|
||||
|
||||
context "with a three element Array" do
|
||||
@@ -132,7 +132,7 @@ describe Tmuxinator::Window do
|
||||
let(:window) { Tmuxinator::Window.new(yaml, 0, project) }
|
||||
|
||||
before do
|
||||
project.stub(
|
||||
allow(project).to receive_messages(
|
||||
:name => "",
|
||||
:tmux => "tmux",
|
||||
:root => "/project/tmuxinator",
|
||||
@@ -142,7 +142,7 @@ describe Tmuxinator::Window do
|
||||
|
||||
context "tmux 1.6 and below" do
|
||||
before do
|
||||
Tmuxinator::Config.stub(:version => 1.6)
|
||||
allow(Tmuxinator::Config).to receive_messages(:version => 1.6)
|
||||
end
|
||||
|
||||
it "specifies root path by passing default-path to tmux" do
|
||||
|
||||
@@ -37,16 +37,17 @@ Gem::Specification.new do |spec|
|
||||
|
||||
spec.required_rubygems_version = ">= 1.8.23"
|
||||
|
||||
spec.add_dependency "thor", ">= 0.18.0"
|
||||
spec.add_dependency "thor", "~> 0.18", ">= 0.18.0"
|
||||
spec.add_dependency "erubis"
|
||||
|
||||
spec.add_development_dependency "bundler", "~> 1.3"
|
||||
spec.add_development_dependency "rspec", ">= 2.14.0"
|
||||
spec.add_development_dependency "rspec", "~> 3.0.0"
|
||||
spec.add_development_dependency "simplecov"
|
||||
spec.add_development_dependency "coveralls"
|
||||
spec.add_development_dependency "awesome_print"
|
||||
spec.add_development_dependency "pry"
|
||||
spec.add_development_dependency "pry-nav"
|
||||
spec.add_development_dependency "factory_girl"
|
||||
spec.add_development_dependency "transpec"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user