spec/depl/main_spec.rb in depl-0.0.1 vs spec/depl/main_spec.rb in depl-0.0.2
- old
+ new
@@ -1,39 +1,37 @@
require 'spec_helper'
describe Depl::Main do
let(:deploy) {
- Depl::Main.new(:environment => 'production',
- :config => {'s3' => 'my-bucket/deployments/foo'})
+ Depl::Main.new(:environment => 'production')
}
describe '#environment' do
it 'uses the passed environment' do
expect(deploy.environment).to eq('production')
end
end
- describe '#filename' do
- it 'computes the filename' do
- expect(deploy.filename).to eql('production.sha')
- end
- end
-
- describe '#key' do
- it 'computes the key' do
- expect(deploy.key).to eq('deployments/foo/production.sha')
- end
- end
-
describe '#diff' do
it 'uses git to find the commits between two shas' do
deploy.should_receive(:remote_sha).and_return("remote")
deploy.should_receive(:local_sha).and_return("local")
cmd = "git log --pretty=format:' %h %<(20)%an %ar\t %s' -10 remote..local"
deploy.should_receive(:execute).with(cmd)
deploy.diff
+ end
+ end
+
+ describe '#save_sha' do
+ it 'pushes a sha to the origin' do
+ deploy.should_receive(:local_sha).and_return("12345")
+
+ cmd = "git push --force origin 12345:refs/heads/deploy-production"
+ deploy.should_receive(:execute).with(cmd)
+
+ deploy.save_sha
end
end
describe '#up_to_date' do
it 'returns true when shas match' do