How to separate Rails Rails tests that make api calls

I am writing rspec tests that cause calls in real time. I want the ability to run all tests other than api using the simple rspec command, and then somehow invoke the live api tests separately. Perhaps there is a way to use ARGV or to exclude some tests from the rspec common namespace and still have full testing capabilities. Any thoughts?

+4
source share
1 answer

You need to tag your API specifications, take a look at the RSpec documentation: https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option

:

spec_helper.rb

RSpec.configure do |c|
  c.filter_run_excluding api: true unless ENV['ALL']
end

rspec spec , api.

, API ALL=true rspec spec.

+3

Source: https://habr.com/ru/post/1536807/


All Articles