Skip to content

Commit

Permalink
Fix rspec deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtfish committed Aug 23, 2014
1 parent 3988e57 commit 8941208
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion spec/lib/synapse/haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 8 additions & 10 deletions spec/lib/synapse/service_watcher_ec2tags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,37 @@ 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
end

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 }
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8941208

Please sign in to comment.