mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
reduce dsl, prefer fetch/set
This commit is contained in:
parent
83f7dd8e96
commit
725c47d35b
1 changed files with 51 additions and 0 deletions
51
spec/lib/capistrano/dsl_spec.rb
Normal file
51
spec/lib/capistrano/dsl_spec.rb
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
module Capistrano
|
||||||
|
|
||||||
|
class DummyClass
|
||||||
|
include DSL
|
||||||
|
end
|
||||||
|
|
||||||
|
describe DSL do
|
||||||
|
let(:dsl) { DummyClass.new }
|
||||||
|
|
||||||
|
describe '#t' do
|
||||||
|
before do
|
||||||
|
I18n.expects(:t).with(:phrase, {count: 2}, scope: :capistrano)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'delegates to I18n' do
|
||||||
|
dsl.t(:phrase, count: 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#stages' do
|
||||||
|
before do
|
||||||
|
Dir.expects(:[]).with('config/deploy/*.rb').
|
||||||
|
returns(['config/deploy/staging.rb', 'config/deploy/production.rb'])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns a list of defined stages' do
|
||||||
|
expect(dsl.stages).to eq %w{staging production}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#stage_set?' do
|
||||||
|
subject { dsl.stage_set? }
|
||||||
|
|
||||||
|
context 'stage is set' do
|
||||||
|
before do
|
||||||
|
dsl.set(:stage, :sandbox)
|
||||||
|
end
|
||||||
|
it { should be_true }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'stage is not set' do
|
||||||
|
before do
|
||||||
|
dsl.set(:stage, nil)
|
||||||
|
end
|
||||||
|
it { should be_false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue