Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
Default to the real outputter in specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Oct 14, 2011
1 parent f260e9e commit bb95538
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 55 deletions.
2 changes: 1 addition & 1 deletion spec/kumade/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::CLI do
describe Kumade::CLI, :with_mock_outputter do
let(:out) { StringIO.new }
let(:environment) { 'my-environment' }
let(:deployer) { stub("Deployer", :new => deployer_instance) }
Expand Down
6 changes: 3 additions & 3 deletions spec/kumade/command_line_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::CommandLine, "#run_or_error" do
describe Kumade::CommandLine, "#run_or_error", :with_mock_outputter do
subject { Kumade::CommandLine.new("echo") }

context "when pretending" do
Expand Down Expand Up @@ -47,7 +47,7 @@
end
end

describe Kumade::CommandLine, "#run_with_status" do
describe Kumade::CommandLine, "#run_with_status", :with_mock_outputter do
let(:command) { "echo" }
let(:command_line) { stub("Cocaine::CommandLine instance", :run => nil, :command => command) }
subject { Kumade::CommandLine.new(command) }
Expand Down Expand Up @@ -87,7 +87,7 @@
end
end

describe Kumade::CommandLine, "#run" do
describe Kumade::CommandLine, "#run", :with_mock_outputter do
context "when successful" do
subject { Kumade::CommandLine.new("echo") }

Expand Down
8 changes: 4 additions & 4 deletions spec/kumade/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require 'spec_helper'

describe Kumade::Configuration, "by default" do
describe Kumade::Configuration, "by default", :with_mock_outputter do
its(:environment) { should == 'staging' }
it { should_not be_pretending }
end

describe Kumade::Configuration, "#pretending" do
describe Kumade::Configuration, "#pretending", :with_mock_outputter do
it "has read/write access for the pretending attribute" do
subject.pretending = true
subject.should be_pretending
end
end

describe Kumade::Configuration, "#pretending?" do
describe Kumade::Configuration, "#pretending?", :with_mock_outputter do
it "returns false when not pretending" do
subject.pretending = false
subject.should_not be_pretending
Expand All @@ -28,7 +28,7 @@
end
end

describe Kumade::Configuration, "#environment" do
describe Kumade::Configuration, "#environment", :with_mock_outputter do
it "has read/write access for the environment attribute" do
subject.environment = 'new-environment'
subject.environment.should == 'new-environment'
Expand Down
12 changes: 6 additions & 6 deletions spec/kumade/deployer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::Deployer, "#pre_deploy" do
describe Kumade::Deployer, "#pre_deploy", :with_mock_outputter do
let(:git) { subject.git }

it "calls the correct methods" do
Expand All @@ -12,7 +12,7 @@
end
end

describe Kumade::Deployer, "#deploy" do
describe Kumade::Deployer, "#deploy", :with_mock_outputter do
let(:remote_name) { 'staging' }

before do
Expand Down Expand Up @@ -43,7 +43,7 @@
end
end

describe Kumade::Deployer, "#sync_origin" do
describe Kumade::Deployer, "#sync_origin", :with_mock_outputter do
let(:new_branch) { 'new-branch' }

before do
Expand All @@ -57,14 +57,14 @@
end
end

describe Kumade::Deployer, "#ensure_clean_git" do
describe Kumade::Deployer, "#ensure_clean_git", :with_mock_outputter do
it "calls git.ensure_clean_git" do
subject.git.expects(:ensure_clean_git)
subject.ensure_clean_git
end
end

describe Kumade::Deployer, "#ensure_heroku_remote_exists" do
describe Kumade::Deployer, "#ensure_heroku_remote_exists", :with_mock_outputter do
let(:environment) { 'staging' }

before do
Expand Down Expand Up @@ -114,7 +114,7 @@
end
end

describe Kumade::Deployer, "packaging" do
describe Kumade::Deployer, "packaging", :with_mock_outputter do
let(:git) { stub("git", :current_branch => "awesome", :delete => true) }
let(:packager) { stub("packager", :run => true) }

Expand Down
20 changes: 10 additions & 10 deletions spec/kumade/git_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::Git, "#heroku_remote?" do
describe Kumade::Git, "#heroku_remote?", :with_mock_outputter do
context "when the environment is a Heroku repository" do
include_context "with Heroku environment"

Expand All @@ -20,7 +20,7 @@
end
end

describe Kumade::Git, ".environments" do
describe Kumade::Git, ".environments", :with_mock_outputter do
let(:environment) { 'staging' }
let(:not_a_heroku_env) { 'fake_heroku' }
let(:not_a_heroku_url) { 'git@github.com:gabebw/kumade.git' }
Expand All @@ -40,7 +40,7 @@
end
end

describe Kumade::Git, "#push" do
describe Kumade::Git, "#push", :with_mock_outputter do
let(:branch) { 'branch' }
let(:remote) { 'my-remote' }
let(:command_line) { stub("Kumade::CommandLine instance", :run_or_error => true) }
Expand All @@ -67,7 +67,7 @@
end
end

describe Kumade::Git, "#create" do
describe Kumade::Git, "#create", :with_mock_outputter do
let(:branch) { "my-new-branch" }
it "creates a branch" do
subject.create(branch)
Expand All @@ -86,7 +86,7 @@
end
end

describe Kumade::Git, "#delete" do
describe Kumade::Git, "#delete", :with_mock_outputter do
let(:branch_to_delete) { 'branch_to_delete' }
let(:branch_to_checkout) { 'branch_to_checkout' }

Expand All @@ -106,7 +106,7 @@
end
end

describe Kumade::Git, "#add_and_commit_all_assets_in" do
describe Kumade::Git, "#add_and_commit_all_assets_in", :with_mock_outputter do
let(:directory) { 'assets' }

before do
Expand Down Expand Up @@ -151,15 +151,15 @@
end
end

describe Kumade::Git, "#current_branch" do
describe Kumade::Git, "#current_branch", :with_mock_outputter do
it "returns the current branch" do
subject.current_branch.should == 'master'
`git checkout -b new-branch 2>/dev/null`
subject.current_branch.should == 'new-branch'
end
end

describe Kumade::Git, "#remote_exists?" do
describe Kumade::Git, "#remote_exists?", :with_mock_outputter do
context "when pretending" do
before { Kumade.configuration.pretending = true }
it "returns true no matter what" do
Expand All @@ -185,7 +185,7 @@
end
end

describe Kumade::Git, "#dirty?" do
describe Kumade::Git, "#dirty?", :with_mock_outputter do
context "when dirty" do
before { dirty_the_repo }

Expand All @@ -198,7 +198,7 @@
end


describe Kumade::Git, "#ensure_clean_git" do
describe Kumade::Git, "#ensure_clean_git", :with_mock_outputter do
context "when pretending" do
before do
Kumade.configuration.pretending = true
Expand Down
12 changes: 6 additions & 6 deletions spec/kumade/heroku_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'spec_helper'

describe Kumade::Heroku, "DEPLOY_BRANCH" do
describe Kumade::Heroku, "DEPLOY_BRANCH", :with_mock_outputter do
subject { Kumade::Heroku::DEPLOY_BRANCH }

it { should == "deploy" }
end

describe Kumade::Heroku, "#sync" do
describe Kumade::Heroku, "#sync", :with_mock_outputter do
let(:environment) { 'staging' }

before do
Expand All @@ -23,7 +23,7 @@
end
end

describe Kumade::Heroku, "#migrate_database" do
describe Kumade::Heroku, "#migrate_database", :with_mock_outputter do
let(:environment) { 'staging' }

before do
Expand Down Expand Up @@ -56,7 +56,7 @@
end
end

describe Kumade::Heroku, "#heroku" do
describe Kumade::Heroku, "#heroku", :with_mock_outputter do
let(:command_instance) { stub("Kumade::CommandLine instance", :run_or_error => true) }

before do
Expand Down Expand Up @@ -86,7 +86,7 @@
end
end

describe Kumade::Heroku, "#cedar?" do
describe Kumade::Heroku, "#cedar?", :with_mock_outputter do
context "when on Cedar" do
include_context "when on Cedar"

Expand All @@ -104,7 +104,7 @@
end
end

describe Kumade::Heroku, "#delete_deploy_branch" do
describe Kumade::Heroku, "#delete_deploy_branch", :with_mock_outputter do
before { subject.git.stubs(:delete) }

it "deletes the deploy branch" do
Expand Down
10 changes: 5 additions & 5 deletions spec/kumade/outputter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::Outputter, "#success", :with_real_outputter => true do
describe Kumade::Outputter, "#success" do
before { STDOUT.stubs(:puts) }

it "prints a message to STDOUT" do
Expand All @@ -9,7 +9,7 @@
end
end

describe Kumade::Outputter, "#error", :with_real_outputter => true do
describe Kumade::Outputter, "#error" do
before { STDOUT.stubs(:puts) }

it "raises a DeploymentError with the given message" do
Expand All @@ -22,7 +22,7 @@
end
end

describe Kumade::Outputter, "#info", :with_real_outputter => true do
describe Kumade::Outputter, "#info" do
before { STDOUT.stubs(:puts) }

it "prints a message to STDOUT" do
Expand All @@ -31,7 +31,7 @@
end
end

describe Kumade::Outputter, "#say_command", :with_real_outputter => true do
describe Kumade::Outputter, "#say_command" do
before { STDOUT.stubs(:puts) }

it "prints a formatted message to STDOUT" do
Expand All @@ -40,7 +40,7 @@
end
end

describe Kumade::Outputter, "#info", :with_real_outputter => true do
describe Kumade::Outputter, "#info" do
before { STDOUT.stubs(:puts) }

it "prints a message to STDOUT" do
Expand Down
2 changes: 1 addition & 1 deletion spec/kumade/packager_list_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::PackagerList, "detecting packages" do
describe Kumade::PackagerList, "detecting packages", :with_mock_outputter do
it "returns an array containing the Jammit packager if Jammit is installed" do
Kumade::JammitPackager.stubs(:installed? => true)
Kumade::MorePackager.stubs(:installed? => false)
Expand Down
4 changes: 2 additions & 2 deletions spec/kumade/packager_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe Kumade::Packager, ".available_packager" do
describe Kumade::Packager, ".available_packager", :with_mock_outputter do
let(:packager_1) { "1st packager" }
let(:packager_2) { "2nd packager" }

Expand All @@ -15,7 +15,7 @@
end
end

describe Kumade::Packager, "#run" do
describe Kumade::Packager, "#run", :with_mock_outputter do
let(:git) { stub("git", :dirty? => true, :add_and_commit_all_assets_in => true) }
let(:packager) { stub("packager", :name => "MyPackager", :package => true, :assets_path => 'fake_assets_path') }
let(:rake_task_runner) { stub("RakeTaskRunner", :invoke => true) }
Expand Down
2 changes: 1 addition & 1 deletion spec/kumade/packagers/jammit_packager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "jammit"

describe Kumade::JammitPackager do
describe Kumade::JammitPackager, :with_mock_outputter do
subject { Kumade::JammitPackager }

it_should_behave_like "packager"
Expand Down
2 changes: 1 addition & 1 deletion spec/kumade/packagers/more_packager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "less"

describe Kumade::MorePackager do
describe Kumade::MorePackager, :with_mock_outputter do
subject { Kumade::MorePackager }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/kumade/packagers/noop_packager_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "spec_helper"

describe Kumade::NoopPackager do
describe Kumade::NoopPackager, :with_mock_outputter do
subject { Kumade::NoopPackager }

it_should_behave_like "packager"
Expand Down
2 changes: 1 addition & 1 deletion spec/kumade/rake_task_runner_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "spec_helper"

describe Kumade::RakeTaskRunner do
describe Kumade::RakeTaskRunner, :with_mock_outputter do
context "when the task doesn't exist" do
subject { Kumade::RakeTaskRunner.new("bogus:task") }

Expand Down
4 changes: 2 additions & 2 deletions spec/kumade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
end
end

describe Kumade, ".outputter", :with_real_outputter => true do
describe Kumade, ".outputter" do
it "defaults to a Kumade::Outputter instance" do
Kumade.outputter.should be_a Kumade::Outputter
end
end

describe Kumade, ".outputter=", :with_real_outputter => true do
describe Kumade, ".outputter=" do
it "sets Kumade.outputter" do
Kumade.outputter = "new-value"
Kumade.outputter.should == "new-value"
Expand Down
Loading

0 comments on commit bb95538

Please sign in to comment.