1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

move to rspec 3

This commit is contained in:
Rustam Zagirov 2014-08-12 22:52:37 +04:00
parent b372e58ffc
commit 2c14957bf4
8 changed files with 41 additions and 40 deletions

View file

@ -5,7 +5,7 @@ gemspec
group :cucumber do
gem 'cucumber'
gem 'rspec', '~>2.14.1'
gem 'rspec', '~> 3.0.0'
end
platforms :rbx do

View file

@ -57,26 +57,26 @@ end
Then(/^the deploy\.rb file is created$/) do
file = TestApp.test_app_path.join('config/deploy.rb')
expect(File.exists?(file)).to be_true
expect(File.exists?(file)).to be true
end
Then(/^the default stage files are created$/) do
staging = TestApp.test_app_path.join('config/deploy/staging.rb')
production = TestApp.test_app_path.join('config/deploy/production.rb')
expect(File.exists?(staging)).to be_true
expect(File.exists?(production)).to be_true
expect(File.exists?(staging)).to be true
expect(File.exists?(production)).to be true
end
Then(/^the tasks folder is created$/) do
path = TestApp.test_app_path.join('lib/capistrano/tasks')
expect(Dir.exists?(path)).to be_true
expect(Dir.exists?(path)).to be true
end
Then(/^the specified stage files are created$/) do
qa = TestApp.test_app_path.join('config/deploy/qa.rb')
production = TestApp.test_app_path.join('config/deploy/production.rb')
expect(File.exists?(qa)).to be_true
expect(File.exists?(production)).to be_true
expect(File.exists?(qa)).to be true
expect(File.exists?(production)).to be true
end
Then(/^it creates the file with the remote_task prerequisite$/) do
@ -90,7 +90,7 @@ Then(/^it will not recreate the file$/) do
end
Then(/^the task is successful$/) do
expect(@success).to be_true
expect(@success).to be true
end
Then(/^the failure task will run$/) do

View file

@ -317,22 +317,22 @@ describe Capistrano::DSL do
context 'variable is an non-empty array' do
let(:linked_files) { %w{1} }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'variable is an empty array' do
let(:linked_files) { [] }
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'variable exists, is not an array' do
let(:linked_files) { stub }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'variable is nil' do
let(:linked_files) { nil }
it { should be_false }
it { expect(subject).to be_falsey }
end
end
@ -368,7 +368,7 @@ describe Capistrano::DSL do
end
it 'sets the backend pty' do
expect(backend.pty).to be_true
expect(backend.pty).to be_truthy
end
it 'sets the backend connection timeout' do

View file

@ -28,7 +28,7 @@ module Capistrano
end
it 'adds the role' do
expect{subject}.to be_true
expect(subject).to be_truthy
end
end
@ -37,22 +37,22 @@ module Capistrano
context 'with the same user, hostname and port' do
let(:hostname) { 'root@hostname:1234' }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'with a different user' do
let(:hostname) { 'deployer@hostname:1234' }
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with a different port' do
let(:hostname) { 'root@hostname:5678' }
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with a different hostname' do
let(:hostname) { 'root@otherserver:1234' }
it { should be_false }
it { expect(subject).to be_falsey }
end
end
@ -69,7 +69,7 @@ module Capistrano
context 'server is not primary' do
it 'is falesy' do
expect(subject).to be_false
expect(subject).to be_falsey
end
end
end
@ -149,7 +149,7 @@ module Capistrano
end
context 'options are empty' do
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'value is a symbol' do
@ -157,34 +157,34 @@ module Capistrano
context 'with :filter' do
let(:options) { { filter: :active }}
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'with :select' do
let(:options) { { select: :active }}
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'with :exclude' do
let(:options) { { exclude: :active }}
it { should be_false }
it { expect(subject).to be_falsey }
end
end
context 'value does not match server properly' do
context 'with :filter' do
let(:options) { { filter: :inactive }}
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with :select' do
let(:options) { { select: :inactive }}
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with :exclude' do
let(:options) { { exclude: :inactive }}
it { should be_true }
it { expect(subject).to be_truthy }
end
end
end
@ -194,17 +194,17 @@ module Capistrano
context 'with :filter' do
let(:options) { { filter: ->(s) { s.properties.active } } }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'with :select' do
let(:options) { { select: ->(s) { s.properties.active } } }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'with :exclude' do
let(:options) { { exclude: ->(s) { s.properties.active } } }
it { should be_false }
it { expect(subject).to be_falsey }
end
end
@ -212,17 +212,17 @@ module Capistrano
context 'value does not match server properly' do
context 'with :filter' do
let(:options) { { filter: ->(s) { s.properties.inactive } } }
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with :select' do
let(:options) { { select: ->(s) { s.properties.inactive } } }
it { should be_false }
it { expect(subject).to be_falsey }
end
context 'with :exclude' do
let(:options) { { exclude: ->(s) { s.properties.inactive } } }
it { should be_true }
it { expect(subject).to be_truthy }
end
end

View file

@ -8,7 +8,7 @@ module Capistrano
describe '.env' do
it 'is a global accessor to a single instance' do
Configuration.env.set(:test, true)
expect(Configuration.env.fetch(:test)).to be_true
expect(Configuration.env.fetch(:test)).to be_truthy
end
end

View file

@ -27,14 +27,14 @@ module Capistrano
before do
dsl.set(:stage, :sandbox)
end
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'stage is not set' do
before do
dsl.set(:stage, nil)
end
it { should be_false }
it { expect(subject).to be_falsey }
end
end

View file

@ -24,7 +24,7 @@ module Capistrano
context 'with exact version' do
context 'valid' do
let(:version) { '3.0.1' }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'invalid - lower' do
@ -48,7 +48,7 @@ module Capistrano
context 'with optimistic versioning' do
context 'valid' do
let(:version) { '>= 3.0.0' }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'invalid - lower' do
@ -66,7 +66,7 @@ module Capistrano
context '2 decimal places' do
context 'valid' do
let(:version) { '~> 3.0.0' }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'invalid' do
@ -83,7 +83,7 @@ module Capistrano
context 'valid' do
let(:version) { '~> 3.1' }
it { should be_true }
it { expect(subject).to be_truthy }
end
context 'invalid' do

View file

@ -3,13 +3,14 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
require 'capistrano/all'
require 'rspec'
require 'mocha/api'
require 'time'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.raise_errors_for_deprecations!
config.mock_framework = :mocha
config.order = 'random'
end