Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup and whitespace.

  • Loading branch information...
commit fda26ee661dfbb1d9a854ae37fe7c385e6fe9616 1 parent afb29cf
@gabebw gabebw authored
View
2  lib/kumade/cli.rb
@@ -7,7 +7,7 @@ class << self
attr_reader :environment
end
- def self.run(args=ARGV, out=StringIO.new)
+ def self.run(args = ARGV, out = StringIO.new)
@out = out
@options = parse_arguments!(args)
@environment = args.shift || 'staging'
View
34 spec/kumade/cli_spec.rb
@@ -1,9 +1,10 @@
require 'spec_helper'
describe Kumade::CLI do
+ let(:out) { StringIO.new }
+ let(:environment) { 'my-environment' }
+
subject { Kumade::CLI }
- let(:out){ StringIO.new }
- let(:environment){ 'my-environment' }
%w(-p --pretend).each do |pretend_arg|
it "sets pretend mode when run with #{pretend_arg}" do
@@ -23,16 +24,16 @@
it "deploys" do
Kumade::Deployer.any_instance.should_receive(:deploy)
- subject.run([environment], out)
+ subject.run
end
-
end
-describe Kumade::CLI do
+describe Kumade::CLI, ".swapping_stdout_for" do
+ let(:stdout) { $stdout }
+ let(:output) { StringIO.new }
+
it 'does not let anything get printed' do
- stdout = $stdout
stdout.should_not_receive(:print)
- output = StringIO.new
Kumade::CLI.swapping_stdout_for(output) do
$stdout.puts "Hello, you can't see me."
@@ -43,9 +44,7 @@
end
it 'dumps the output stash to real stdout when an error happens' do
- stdout = $stdout
stdout.should_receive(:print)
- output = StringIO.new
Kumade::CLI.swapping_stdout_for(output) do
$stdout.puts "Hello, you can see me!"
@@ -53,14 +52,17 @@
end
end
- it 'prints everything in pretend mode' do
- stdout = $stdout
- stdout.should_receive(:puts)
- output = StringIO.new
- Kumade::CLI.should_receive(:pretending?).and_return(true)
+ context "in pretend mode" do
+ before do
+ Kumade::CLI.should_receive(:pretending?).and_return(true)
+ end
- Kumade::CLI.swapping_stdout_for(output) do
- $stdout.puts "Hello, you can see me!"
+ it 'prints everything' do
+ stdout.should_receive(:puts)
+
+ Kumade::CLI.swapping_stdout_for(output) do
+ $stdout.puts "Hello, you can see me!"
+ end
end
end
end
View
5 spec/kumade/deployer_spec.rb
@@ -346,12 +346,12 @@ class More
Rake::Task.clear
end
- it "returns true if it task found" do
+ it "returns true if the task exists" do
namespace :kumade do
task :before_asset_compilation do
-
end
end
+
Kumade::Deployer.new.custom_task?.should be_true
end
@@ -404,7 +404,6 @@ class More
end
end
-
context "when the remote does not exist" do
subject { Kumade::Deployer.new(environment) }
before { remove_remote(environment) }
View
43 spec/kumade/git_spec.rb
@@ -27,7 +27,6 @@
it "returns false when the remote is not a heroku repository" do
Kumade::Git.new(false, 'kumade').heroku_remote?.should be_false
end
-
end
describe Kumade::Git, ".environments" do
@@ -51,39 +50,39 @@
end
describe Kumade::Git, "#branch_exist?" do
- let(:comand_line_mock) { mock("Cocaine::CommandLine") }
- let(:branch) { "branch" }
- let(:environment) { "staging" }
-
+ let(:command_line_mock) { mock("Cocaine::CommandLine") }
+ let(:branch) { "branch" }
+ let(:environment) { "staging" }
+
subject { Kumade::Git.new(false, environment) }
- before(:each) do
- Cocaine::CommandLine.should_receive(:new).with("git show-ref #{branch}").and_return(comand_line_mock)
+ before do
+ Cocaine::CommandLine.should_receive(:new).with("git show-ref #{branch}").and_return(command_line_mock)
end
-
- it "should return true when branch exist" do
- comand_line_mock.should_receive(:run)
+
+ it "returns true when the branch exists" do
+ command_line_mock.should_receive(:run)
subject.branch_exist?("branch").should be_true
end
-
- it "should return false if branch doesn't exist" do
- comand_line_mock.should_receive(:run).and_raise(Cocaine::ExitStatusError)
+
+ it "returns false if the branch doesn't exist" do
+ command_line_mock.should_receive(:run).and_raise(Cocaine::ExitStatusError)
subject.branch_exist?("branch").should be_false
end
end
describe Kumade::Git, "#dirty?" do
- let(:environment) { "staging" }
-
- subject { Kumade::Git.new(false, environment) }
+ subject { Kumade::Git.new(false, "staging") }
- it "should return true when dirty" do
+ it "returns true when dirty" do
subject.should_receive(:run).with("git diff --exit-code").and_return(false)
- subject.dirty?.should be_true
+
+ subject.should be_dirty
end
-
- it "should return false when not dirty" do
+
+ it "returns false when not dirty" do
subject.should_receive(:run).with("git diff --exit-code").and_return(true)
- subject.dirty?.should be_false
+
+ subject.should_not be_dirty
end
-end
+end

0 comments on commit fda26ee

Please sign in to comment.
Something went wrong with that request. Please try again.