From 8941208b7e01bab8f6b44cabde6660be6002cef5 Mon Sep 17 00:00:00 2001 From: Tomas Doran Date: Sat, 23 Aug 2014 16:50:07 +0100 Subject: [PATCH] Fix rspec deprecation warnings --- spec/lib/synapse/haproxy_spec.rb | 2 +- .../synapse/service_watcher_ec2tags_spec.rb | 18 ++++++++---------- spec/spec_helper.rb | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/spec/lib/synapse/haproxy_spec.rb b/spec/lib/synapse/haproxy_spec.rb index 9c68183d..df1bb261 100644 --- a/spec/lib/synapse/haproxy_spec.rb +++ b/spec/lib/synapse/haproxy_spec.rb @@ -7,7 +7,7 @@ class MockWatcher; end; it 'updating the config' do mockWatcher = double(Synapse::ServiceWatcher) - subject.should_receive(:generate_config) + expect(subject).to receive(:generate_config) subject.update_config([mockWatcher]) end end diff --git a/spec/lib/synapse/service_watcher_ec2tags_spec.rb b/spec/lib/synapse/service_watcher_ec2tags_spec.rb index 40ff8df3..781ff48b 100644 --- a/spec/lib/synapse/service_watcher_ec2tags_spec.rb +++ b/spec/lib/synapse/service_watcher_ec2tags_spec.rb @@ -135,11 +135,11 @@ def munge_haproxy_arg(name, new_value) # done remotely; breaking into separate calls would result in # unnecessary data being retrieved. - subject.ec2.should_receive(:instances).and_return(instance_collection) + expect(subject.ec2).to receive(:instances).and_return(instance_collection) - instance_collection.should_receive(:tagged).with('foo').and_return(instance_collection) - instance_collection.should_receive(:tagged_values).with('bar').and_return(instance_collection) - instance_collection.should_receive(:select).and_return(instance_collection) + expect(instance_collection).to receive(:tagged).with('foo').and_return(instance_collection) + expect(instance_collection).to receive(:tagged_values).with('bar').and_return(instance_collection) + expect(instance_collection).to receive(:select).and_return(instance_collection) subject.send(:instances_with_tags, 'foo', 'bar') end @@ -147,27 +147,25 @@ def munge_haproxy_arg(name, new_value) context 'returned backend data structure' do before do - subject.stub(:instances_with_tags).and_return([instance1, instance2]) + expect(subject).to receive(:instances_with_tags).and_return([instance1, instance2]) end let(:backends) { subject.send(:discover_instances) } it 'returns an Array of backend name/host/port Hashes' do - expect { backends.all? {|b| %w[name host port].each {|k| b.has_key?(k) }} }.to be_true + expect(backends.all? {|b| %w[name host port].each {|k| b.has_key?(k) }}).to eql(true) end it 'sets the backend port to server_port_override for all backends' do backends = subject.send(:discover_instances) - expect { - backends.all? { |b| b['port'] == basic_config['haproxy']['server_port_override'] } - }.to be_true + expect(backends.all? { |b| b['port'] == basic_config['haproxy']['server_port_override'] }).to eql(true) end end context 'returned instance fields' do before do - subject.stub(:instances_with_tags).and_return([instance1]) + expect(subject).to receive(:instances_with_tags).and_return([instance1]) end let(:backend) { subject.send(:discover_instances).pop } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e9211252..3f18c172 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,6 @@ require 'support/configuration' RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus config.include Configuration