0

I am using rspec with capybara for testing.

I want to test my api end point, I can do it with rspec. But while searching on net for api testing I found a gem vcr which can save api call response in yml file, So no multiple hit on server and also decrease test run time.

I have tried to configure it with local environment, But seems like it work for external api calls only.

Anyone having experience in configure with local environment setup.

Tried setup capaybara to run server in test environment but didn't get any success.

Capybara.configure do |config|
  config.run_server = true
  config.server_port = 7000
  config.app_host = 'http://localhost:7000'
end

But getting following issue:

Errno::ECONNREFUSED:
      Connection refused - connect(2) for "localhost" port 7000
Dipak Gupta
  • 7,321
  • 1
  • 20
  • 32
  • have you seen this? http://stackoverflow.com/questions/17141004/errnoeconnrefused-connection-refused-connect2-for-action-mailer – fabdurso Dec 23 '15 at 12:36
  • It's different. I want to run server for api testing. – Dipak Gupta Dec 23 '15 at 12:45
  • Why did you decide that it works only with external servers? Did you get any errors in standard configuration (without tweaking Capybara)? I used VCR to test API calls to local server and it worked without any additional settings. – Jeiwan Dec 23 '15 at 14:10
  • I have added proper configuration for VCR as describe in their gem. But it not connecting to url and recording cassette also. When I run my local development server and give complete url for my development server it record properly – Dipak Gupta Dec 23 '15 at 14:21
  • Can you please update your configuration and one sample test. So I can try update my test case. – Dipak Gupta Dec 24 '15 at 06:41

0 Answers0