Hi, I am currently having a issue with respect to execution order of tests in our rspec suite. Our application is big data pipeline where the front facing server (collector) accepts requests and sends the data to other components for transformation. So the collector responds with 202 status rather than 200. After few seconds the data is available for querying. The Querying server (QueryAPI) responds to certain queries on the data. In order to test this, I have to put data into collector, wait for sometime and query the QueryAPI and assert the result. I didnt want to repeat this process for every test as sleeping for every test is time consuming. So currently the tests are like put all the data required to the collector in before block and at the end of before block, wait for sometime and then the "it" block will call QueryAPI and assert. This seems ugly as it is difficult for me to map the test data with the test. Is there a way to create two custom blocks viz. ingest" bock & "query" block inside "it" block and then run all ingest blocks together, wait for sometime and run query blocks. This will help in readability of the tests. Below is an example of what i want
describe "Test" do
it "Test 1" do
ingest "collector" do
#input data here
end
query "queryapi" do
assert result here
end
end
it "Test 2" do
ingest "collector" do
#input data here
end
query "queryapi" do
assert result here
end
end
end
The ingest blocks of two tests should run first, wait for sometime and then run the query blocks. Is this possible?