(rubocop) Fix Style/BracesAroundHashParameters

This commit is contained in:
Tim Sharpe 2019-02-03 11:08:05 +11:00
parent 79f764560d
commit d95c6946b8
2 changed files with 11 additions and 11 deletions

View file

@ -45,14 +45,14 @@ describe Service do
describe '#delete_token' do describe '#delete_token' do
it 'deletes a token' do it 'deletes a token' do
service = Service.new(MockOptions.new,{'user' => 'first.last', 'url' => 'http://default.url'}) service = Service.new(MockOptions.new,'user' => 'first.last', 'url' => 'http://default.url')
allow(Commander::UI).to(receive(:password) allow(Commander::UI).to(receive(:password)
.with('Enter your pooler service password:', '*') .with('Enter your pooler service password:', '*')
.and_return('hunter2')) .and_return('hunter2'))
allow(Auth).to(receive(:delete_token) allow(Auth).to(receive(:delete_token)
.with(nil, 'http://default.url', 'first.last', 'hunter2', 'token-value') .with(nil, 'http://default.url', 'first.last', 'hunter2', 'token-value')
.and_return('ok' => true)) .and_return('ok' => true))
expect(service.delete_token(nil, 'token-value')).to eql({'ok' => true}) expect(service.delete_token(nil, 'token-value')).to eql('ok' => true)
end end
end end

View file

@ -114,27 +114,27 @@ describe Utils do
it 'allows selection by configured service key' do it 'allows selection by configured service key' do
config = @default_config.merge @services_config config = @default_config.merge @services_config
options = MockOptions.new({:service => 'ns'}) options = MockOptions.new(:service => 'ns')
expect(Utils.get_service_config(config, options)).to include @services_config['services']['ns'] expect(Utils.get_service_config(config, options)).to include @services_config['services']['ns']
end end
it 'uses top-level service config values as defaults when configured service values are missing' do it 'uses top-level service config values as defaults when configured service values are missing' do
config = @default_config.merge @services_config config = @default_config.merge @services_config
config['services']['vm'].delete 'url' config['services']['vm'].delete 'url'
options = MockOptions.new({:service => 'vm'}) options = MockOptions.new(:service => 'vm')
expect(Utils.get_service_config(config, options)['url']).to eq 'http://default.url' expect(Utils.get_service_config(config, options)['url']).to eq 'http://default.url'
end end
it "raises an error if passed a service name that hasn't been configured" do it "raises an error if passed a service name that hasn't been configured" do
config = @default_config.merge @services_config config = @default_config.merge @services_config
options = MockOptions.new({:service => 'none'}) options = MockOptions.new(:service => 'none')
expect { Utils.get_service_config(config, options) }.to raise_error ArgumentError expect { Utils.get_service_config(config, options) }.to raise_error ArgumentError
end end
it 'prioritizes values passed as command line options over configuration options' do it 'prioritizes values passed as command line options over configuration options' do
config = @default_config config = @default_config
options = MockOptions.new({:url => 'http://alternate.url', :token => 'alternate-token'}) options = MockOptions.new(:url => 'http://alternate.url', :token => 'alternate-token')
expected = config.merge({'url' => 'http://alternate.url', 'token' => 'alternate-token'}) expected = config.merge('url' => 'http://alternate.url', 'token' => 'alternate-token')
expect(Utils.get_service_config(config, options)).to include expected expect(Utils.get_service_config(config, options)).to include expected
end end
end end
@ -172,7 +172,7 @@ describe Utils do
expect(Utils).to receive(:puts).with(output) expect(Utils).to receive(:puts).with(output)
service = Service.new(MockOptions.new, {'url' => url}) service = Service.new(MockOptions.new, 'url' => url)
allow(service).to receive(:query) allow(service).to receive(:query)
.with(nil, hostname) .with(nil, hostname)
.and_return(response_body) .and_return(response_body)
@ -198,7 +198,7 @@ describe Utils do
expect(Utils).to receive(:puts).with(output) expect(Utils).to receive(:puts).with(output)
service = Service.new(MockOptions.new, {'url' => url}) service = Service.new(MockOptions.new, 'url' => url)
allow(service).to receive(:query) allow(service).to receive(:query)
.with(nil, hostname) .with(nil, hostname)
.and_return(response_body) .and_return(response_body)
@ -219,7 +219,7 @@ describe Utils do
expect(Utils).to receive(:puts).with(output) expect(Utils).to receive(:puts).with(output)
service = Service.new(MockOptions.new, {'url' => url, 'type' => 'ns'}) service = Service.new(MockOptions.new, 'url' => url, 'type' => 'ns')
allow(service).to receive(:query) allow(service).to receive(:query)
.with(nil, hostname) .with(nil, hostname)
.and_return(response_body) .and_return(response_body)
@ -240,7 +240,7 @@ describe Utils do
expect(Utils).to receive(:puts).with(output) expect(Utils).to receive(:puts).with(output)
service = Service.new(MockOptions.new, {'url' => url, 'type' => 'ns'}) service = Service.new(MockOptions.new, 'url' => url, 'type' => 'ns')
allow(service).to receive(:query) allow(service).to receive(:query)
.with(nil, hostname) .with(nil, hostname)
.and_return(response_body) .and_return(response_body)