mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Fix Style/SpaceInsideBlockBraces
This commit is contained in:
parent
48ca7b7ed1
commit
ff9e0ac3a3
5 changed files with 19 additions and 19 deletions
|
@ -26,7 +26,7 @@ module Capistrano
|
||||||
|
|
||||||
def select?(options)
|
def select?(options)
|
||||||
options.each do |k,v|
|
options.each do |k,v|
|
||||||
callable = v.respond_to?(:call) ? v: ->(server){server.fetch(v)}
|
callable = v.respond_to?(:call) ? v: ->(server){ server.fetch(v) }
|
||||||
result = \
|
result = \
|
||||||
case k
|
case k
|
||||||
when :filter, :select
|
when :filter, :select
|
||||||
|
|
|
@ -54,7 +54,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
def repo_path
|
def repo_path
|
||||||
Pathname.new(fetch(:repo_path, ->(){deploy_path.join("repo")}))
|
Pathname.new(fetch(:repo_path, ->(){ deploy_path.join("repo") }))
|
||||||
end
|
end
|
||||||
|
|
||||||
def shared_path
|
def shared_path
|
||||||
|
|
|
@ -8,14 +8,14 @@ module Capistrano
|
||||||
describe "adding a role" do
|
describe "adding a role" do
|
||||||
subject { server.add_role(:test) }
|
subject { server.add_role(:test) }
|
||||||
it "adds the role" do
|
it "adds the role" do
|
||||||
expect{subject}.to change{server.roles.size}.from(0).to(1)
|
expect{ subject }.to change{ server.roles.size }.from(0).to(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "adding roles" do
|
describe "adding roles" do
|
||||||
subject { server.add_roles([:things, :stuff]) }
|
subject { server.add_roles([:things, :stuff]) }
|
||||||
it "adds the roles" do
|
it "adds the roles" do
|
||||||
expect{subject}.to change{server.roles.size}.from(0).to(2)
|
expect{ subject }.to change{ server.roles.size }.from(0).to(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -160,46 +160,46 @@ module Capistrano
|
||||||
context "value matches server property" do
|
context "value matches server property" do
|
||||||
|
|
||||||
context "with :filter" do
|
context "with :filter" do
|
||||||
let(:options) { { :filter => :active }}
|
let(:options) { { :filter => :active } }
|
||||||
it { expect(subject).to be_truthy }
|
it { expect(subject).to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :select" do
|
context "with :select" do
|
||||||
let(:options) { { :select => :active }}
|
let(:options) { { :select => :active } }
|
||||||
it { expect(subject).to be_truthy }
|
it { expect(subject).to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :exclude" do
|
context "with :exclude" do
|
||||||
let(:options) { { :exclude => :active }}
|
let(:options) { { :exclude => :active } }
|
||||||
it { expect(subject).to be_falsey }
|
it { expect(subject).to be_falsey }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "value does not match server properly" do
|
context "value does not match server properly" do
|
||||||
context "with :active true" do
|
context "with :active true" do
|
||||||
let(:options) { { :active => true }}
|
let(:options) { { :active => true } }
|
||||||
it { expect(subject).to be_truthy }
|
it { expect(subject).to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :active false" do
|
context "with :active false" do
|
||||||
let(:options) { { :active => false }}
|
let(:options) { { :active => false } }
|
||||||
it { expect(subject).to be_falsey }
|
it { expect(subject).to be_falsey }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "value does not match server properly" do
|
context "value does not match server properly" do
|
||||||
context "with :filter" do
|
context "with :filter" do
|
||||||
let(:options) { { :filter => :inactive }}
|
let(:options) { { :filter => :inactive } }
|
||||||
it { expect(subject).to be_falsey }
|
it { expect(subject).to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :select" do
|
context "with :select" do
|
||||||
let(:options) { { :select => :inactive }}
|
let(:options) { { :select => :inactive } }
|
||||||
it { expect(subject).to be_falsey }
|
it { expect(subject).to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :exclude" do
|
context "with :exclude" do
|
||||||
let(:options) { { :exclude => :inactive }}
|
let(:options) { { :exclude => :inactive } }
|
||||||
it { expect(subject).to be_truthy }
|
it { expect(subject).to be_truthy }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -207,12 +207,12 @@ module Capistrano
|
||||||
|
|
||||||
context "key is a property" do
|
context "key is a property" do
|
||||||
context "with :active true" do
|
context "with :active true" do
|
||||||
let(:options) { { :active => true }}
|
let(:options) { { :active => true } }
|
||||||
it { expect(subject).to be_truthy }
|
it { expect(subject).to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with :active false" do
|
context "with :active false" do
|
||||||
let(:options) { { :active => false }}
|
let(:options) { { :active => false } }
|
||||||
it { expect(subject).to be_falsey }
|
it { expect(subject).to be_falsey }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Capistrano
|
||||||
describe "adding a role" do
|
describe "adding a role" do
|
||||||
|
|
||||||
it "adds two new server instances" do
|
it "adds two new server instances" do
|
||||||
expect{servers.add_role(:app, %w{1 2})}.
|
expect{ servers.add_role(:app, %w{1 2}) }.
|
||||||
to change{servers.count}.from(0).to(2)
|
to change{ servers.count }.from(0).to(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "handles de-duplification within roles" do
|
it "handles de-duplification within roles" do
|
||||||
|
@ -39,8 +39,8 @@ module Capistrano
|
||||||
servers.add_host("1", :db => { :master => true })
|
servers.add_host("1", :db => { :master => true })
|
||||||
expect(servers.count).to eq(2)
|
expect(servers.count).to eq(2)
|
||||||
expect(servers.roles_for([:db]).count).to eq 2
|
expect(servers.roles_for([:db]).count).to eq 2
|
||||||
expect(servers.find(){|s| s.hostname == "1"}.properties.db).to eq({ :port => 1234, :master => true })
|
expect(servers.find(){ |s| s.hostname == "1" }.properties.db).to eq({ :port => 1234, :master => true })
|
||||||
expect(servers.find(){|s| s.hostname == "2"}.properties.db).to eq({ :port => 1234 })
|
expect(servers.find(){ |s| s.hostname == "2" }.properties.db).to eq({ :port => 1234 })
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ require "time"
|
||||||
|
|
||||||
# Requires supporting files with custom matchers and macros, etc,
|
# Requires supporting files with custom matchers and macros, etc,
|
||||||
# in ./support/ and its subdirectories.
|
# in ./support/ and its subdirectories.
|
||||||
Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
|
Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each { |f| require f }
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.raise_errors_for_deprecations!
|
config.raise_errors_for_deprecations!
|
||||||
|
|
Loading…
Reference in a new issue