Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate FactoryGirl fixtures into Rambo-generated tests #89

Open
1 of 3 tasks
danascheider opened this issue Jul 17, 2016 · 0 comments
Open
1 of 3 tasks

Incorporate FactoryGirl fixtures into Rambo-generated tests #89

danascheider opened this issue Jul 17, 2016 · 0 comments

Comments

@danascheider
Copy link
Owner

danascheider commented Jul 17, 2016

Summary

Since most APIs persist data, Rambo needs some way to ensure data exist in the database when tests are run. For version 0.8, we will be adding FactoryGirl to Rambo-generated tests, relying on users to define appropriate factories and deriving the factory name from the resource name in the URI partial. This work is in progress on the add-factory-girl branch.

Expected Behavior

Given a route called /widgets, Rambo-generated tests should instantiate some Widget objects prior to running the tests.

Given a route called /widgets/:id, Rambo-generated tests should intelligently use the ID from one of the Widget objects it has created for the route. (See also issues #87 and #88.)

Current Behavior

Rambo has no way to handle persisted data in its tests.

Technical Challenges

  • Ensure both ActiveRecord and Sequel are supported. This should come down to the user's FactoryGirl configuration, but we will create some test APIs to verify.
  • Identify a class given a route name. For version 0.8, we will be assuming that the name of a model is the same as the name of the route - e.g., /widgets corresponds to a Widget class, /books to a Book class, etc.
  • Determine what resource(s) a route refers to. Especially, in the case of an individual resource route, Rambo-generated tests need to recognize the resource as an instance of a parent collection and draw in an appropriate fixture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant