Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Default to the real outputter in specs.

  • Loading branch information...
commit bb9553888f10be176a8d23310c904337a904b76d 1 parent f260e9e
@gabebw gabebw authored
View
2  spec/kumade/cli_spec.rb
@@ -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) }
View
6 spec/kumade/command_line_spec.rb
@@ -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
@@ -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) }
@@ -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") }
View
8 spec/kumade/configuration_spec.rb
@@ -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
@@ -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'
View
12 spec/kumade/deployer_spec.rb
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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) }
View
20 spec/kumade/git_spec.rb
@@ -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"
@@ -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' }
@@ -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) }
@@ -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)
@@ -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' }
@@ -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
@@ -151,7 +151,7 @@
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`
@@ -159,7 +159,7 @@
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
@@ -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 }
@@ -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
View
12 spec/kumade/heroku_spec.rb
@@ -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
@@ -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
@@ -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
@@ -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"
@@ -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
View
10 spec/kumade/outputter_spec.rb
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
View
2  spec/kumade/packager_list_spec.rb
@@ -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)
View
4 spec/kumade/packager_spec.rb
@@ -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" }
@@ -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) }
View
2  spec/kumade/packagers/jammit_packager_spec.rb
@@ -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"
View
2  spec/kumade/packagers/more_packager_spec.rb
@@ -2,7 +2,7 @@
require "less"
-describe Kumade::MorePackager do
+describe Kumade::MorePackager, :with_mock_outputter do
subject { Kumade::MorePackager }
before do
View
2  spec/kumade/packagers/noop_packager_spec.rb
@@ -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"
View
2  spec/kumade/rake_task_runner_spec.rb
@@ -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") }
View
4 spec/kumade_spec.rb
@@ -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"
View
19 spec/spec_helper.rb
@@ -45,17 +45,14 @@ def remove_remote(remote_name)
end
end
- # Ensure that examples tagged :with_real_outputter use a real outputter and
- # everything else uses a mock.
- config.before do |example_group|
- if example_group.example.metadata.key?(:with_real_outputter)
- if defined?(:@__real_outputter)
- Kumade.outputter = @__real_outputter
- end
- else
- @__real_outputter = Kumade.outputter unless Kumade.outputter.is_a?(Mocha::Mock)
- Kumade.outputter = stub("Null Outputter", :success => true, :error => true, :info => true, :say_command => true)
- end
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+
+ config.before(:each, :with_mock_outputter) do
+ Kumade.outputter = stub("Null Outputter", :success => true, :error => true, :info => true, :say_command => true)
+ end
+
+ config.after(:each, :with_mock_outputter) do
+ Kumade.outputter = Kumade::Outputter.new
end
config.after do
Please sign in to comment.
Something went wrong with that request. Please try again.