ruby on rails - Configuring test database so It doesn't clear data after tests run for a specific spec file -


I am currently writing outline for a Rail API (Rail 4). I have a special idea for which a test for each test in the file requires a token and it is reused.

However, after each the and description block database is expunged and a new token is generated.

Once these ten or too many tests are run, then the database is free to clean.

Some references

the object, (token), is automatically generated at the endpoint on the GET request. The second obtain request from the same user will use the same token to return a new set of results, recalling on the user's request.

I am trying to test this conversation.

Question

What people suggest that this functionality will provide?

To be in the database, I need a special object or, how will I know about solving it?

I'm looking at configuring the database cleaner gem, but there is no mention of configuring database cleanup for specific cases like this.

Thanks in advance.

You can configure; After all the tests

  RSpec.configure do | Config | Config.before: all do # token end config After: remove all do # token DataCleaner.clean end end  

Comments