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

Commit

Permalink
Use let(:git_mock) { mock() }.
Browse files Browse the repository at this point in the history
  • Loading branch information
tapajos committed Aug 31, 2011
1 parent dcbb11f commit bfa8d78
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions spec/kumade/deployer_spec.rb
Expand Up @@ -61,28 +61,31 @@
end

describe Kumade::Deployer, "#sync_github" do
before { subject.stub(:git).and_return(@git_mock = mock()) }
let(:git_mock) { mock() }
before { subject.stub(:git => git_mock) }
it "should call @git.push" do
@git_mock.should_receive(:push).with("master")
git_mock.should_receive(:push).with("master")
subject.sync_github
end
end

describe Kumade::Deployer, "#sync_heroku" do
let(:environment) { 'my-env' }
subject { Kumade::Deployer.new(environment) }
before { subject.stub(:git).and_return(@git_mock = mock()) }
let(:git_mock) { mock() }
before { subject.stub(:git => git_mock) }
it "should call git.create and git.push" do
@git_mock.should_receive(:create).with("deploy")
@git_mock.should_receive(:push).with("deploy:master", environment, true)
git_mock.should_receive(:create).with("deploy")
git_mock.should_receive(:push).with("deploy:master", environment, true)
subject.sync_heroku
end
end

describe Kumade::Deployer, "#ensure_clean_git" do
before { subject.stub(:git).and_return(@git_mock = mock()) }
let(:git_mock) { mock() }
before { subject.stub(:git => git_mock) }
it "should call git.ensure_clean_git" do
@git_mock.should_receive(:ensure_clean_git)
git_mock.should_receive(:ensure_clean_git)
subject.ensure_clean_git
end
end
Expand Down Expand Up @@ -277,10 +280,11 @@
end

describe Kumade::Deployer, "#git_add_and_commit_all_assets_in" do
before {subject.stub(:git => @git_mock = mock())}
let(:git_mock) { mock() }
before { subject.stub(:git => git_mock) }

it "should call git.add_and_commit_all_in" do
@git_mock.should_receive(:add_and_commit_all_in).with("dir", 'deploy', 'Compiled assets', "Added and committed all assets", "couldn't commit assets")
git_mock.should_receive(:add_and_commit_all_in).with("dir", 'deploy', 'Compiled assets', "Added and committed all assets", "couldn't commit assets")
subject.git_add_and_commit_all_assets_in("dir")
end
end
Expand Down Expand Up @@ -447,10 +451,11 @@ class More
end

describe Kumade::Deployer, "#post_deploy" do
before { subject.stub(:git => @git_mock = mock()) }
let(:git_mock) { mock() }
before { subject.stub(:git => git_mock) }

it "should call git.delete" do
@git_mock.should_receive(:delete).with('deploy', 'master')
git_mock.should_receive(:delete).with('deploy', 'master')
subject.post_deploy
end
end

0 comments on commit bfa8d78

Please sign in to comment.