In my rails application I have some backend jobs using Stalker and Beanstalkd. Part of those jobs is to make an API call to the web interface of the application. I want to write an end-to-end rspec test for this job, where the job under test makes an actual API call to the rails application.
Trouble is - I always get connection refused connecting to the default rails web port, 3000
:
Errno::ECONNREFUSED: Failed to open TCP connection to localhost:3000 (Connection refused - connect(2) for "localhost" port 3000)
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/webmock-1.24.2/lib/webmock/http_lib_adapters/net_http.rb:136:in `start_with_connect_without_finish'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/webmock-1.24.2/lib/webmock/http_lib_adapters/net_http.rb:104:in `request'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/net_http_ext.rb:51:in `request'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/request.rb:210:in `block in transmit'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/webmock-1.24.2/lib/webmock/http_lib_adapters/net_http.rb:123:in `start_without_connect'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/webmock-1.24.2/lib/webmock/http_lib_adapters/net_http.rb:150:in `start'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/request.rb:206:in `transmit'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/request.rb:68:in `execute'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/request.rb:35:in `execute'
/Users/dalvizu/.rvm/gems/ruby-2.3.3/gems/rest-client-1.6.9/lib/restclient/resource.rb:76:in `put'
I am using rspec to run my tests - so far I tried declaring my test to be of type :feature
or :request
-- do these start an actual application server and hit port 3000? Is there any way I can do this in my test? Am I using the wrong port?