Docker Compose With Mongo throwing connection error

When I run my docker compose command it dies due to it not being able to connect to mongo.

docker-compose.yml

rspec:
  image: notifications/api:$APP_ENV
  environment:
    MONGODB_HOST: mongodb
    REDIS_HOST: redis
    RAILS_ENV: test
  links:
    - mongodb
    - redis
  command: rspec
mongodb:
  image: mongo:3.2.3
  expose:
    - "27017"
redis:
  image: redis
  expose:
    - "6379"

The error it throws

D, [2016-11-11T20:31:09.865126 #1] DEBUG -- : MONGODB | Adding localhost:27017 to the cluster.
D, [2016-11-11T20:31:09.867291 #1] DEBUG -- : MONGODB | Connection refused - connect(2) for 127.0.0.1:27017

Finished in 30.14 seconds (files took 2.17 seconds to load)
0 examples, 0 failures

Coverage report generated for RSpec to /webapp/current/coverage. 430 / 669 LOC (64.28%) covered.
/usr/local/bundle/gems/mongo-2.3.0/lib/mongo/server_selector/selectable.rb:108:in `select_server': No server is available matching preference: #<Mongo::ServerSelector::Primary:0x70209107948540 tag_sets=[]> using server_selection_timeout=30 and local_threshold=0.015 (Mongo::Error::NoServerAvailable)
	from /usr/local/bundle/gems/mongo-2.3.0/lib/mongo/cluster.rb:171:in `next_primary'
	from /usr/local/bundle/gems/mongo-2.3.0/lib/mongo/index/view.rb:186:in `each'
	from /usr/local/bundle/gems/mongoid-6.0.0.rc0/lib/mongoid/tasks/database.rb:46:in `block in undefined_indexes'
	from /usr/local/bundle/gems/mongoid-6.0.0.rc0/lib/mongoid/tasks/database.rb:43:in `each'
	from /usr/local/bundle/gems/mongoid-6.0.0.rc0/lib/mongoid/tasks/database.rb:43:in `undefined_indexes'
	from /usr/local/bundle/gems/mongoid-6.0.0.rc0/lib/mongoid/tasks/database.rb:75:in `remove_undefined_indexes'
	from /webapp/current/spec/rails_helper.rb:53:in `block (2 levels) in <top (required)>'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/example.rb:443:in `instance_exec'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/example.rb:443:in `instance_exec'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/hooks.rb:350:in `run'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/configuration.rb:1879:in `block in run_hooks_with'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/configuration.rb:1879:in `each'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/configuration.rb:1879:in `run_hooks_with'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/configuration.rb:1835:in `with_suite_hooks'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:112:in `block in run_specs'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/reporter.rb:77:in `report'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:111:in `run_specs'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:87:in `run'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:71:in `run'
	from /usr/local/bundle/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:45:in `invoke'
	from /usr/local/bundle/gems/rspec-core-3.5.2/exe/rspec:4:in `<top (required)>'
	from /usr/local/bundle/bin/rspec:17:in `load'
	from /usr/local/bundle/bin/rspec:17:in `<main>'