Leo Le Leo Le - 4 months ago 7x
Ruby Question

Run group of test in rspec

My application has some functions that are using httparty service to get data from another website. So it takes a lot of time when run the test for http functions.

- spec
-- services
--- http_request
---- test_http_a_spec.rb
---- test_http_b_spec.rb
--- component
---- test_component_c_spec.rb
---- test_component_d_spec.rb
--- models
---- test_model_e_spec.rb

So how can I run rspec test for all tests except the tests in
folder ?


You may want to tag your http tests with rspec filters and rspec tags.

For example, in spec/services/http_request/test_http_a_spec.rb:

describe WhatEver
  describe 'Testing', http: true do
     it 'should work' do
       # ...

And then, run your tests with rspec --tag ~http. Tests with tag http: true will not be executed.

On the other hand, if your http tests are taking so long to execute, you may probably want to read this article.