Permalink
Browse files

Use let(:git_mock) { mock() }.

  • Loading branch information...
1 parent dcbb11f commit bfa8d78b2d72d15bc3d9076721f7662a94a5045e @tapajos tapajos committed Aug 31, 2011
Showing with 16 additions and 11 deletions.
  1. +16 −11 spec/kumade/deployer_spec.rb
@@ -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
@@ -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
@@ -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.