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

Assignment 7-1 - Testing the Rails Dictionary #24

Closed
8 of 19 tasks
gstark opened this issue Oct 5, 2015 · 2 comments
Closed
8 of 19 tasks

Assignment 7-1 - Testing the Rails Dictionary #24

gstark opened this issue Oct 5, 2015 · 2 comments
Assignees

Comments

@gstark
Copy link

gstark commented Oct 5, 2015

You've been hired at Webster's dictionary to help create a test suite for their new Rails based dictionary app that is live in production. They report that some features on the site break from time to time and they feel a good test suite will help them take on the folks over at Oxford English.

Adventure Mode

  • Using your existing rails dictionary repository
  • Add unit tests for each of your active record models
    • For each attribute that validates presence, add a test to ensure that a newly created model must have that attribute.
    • For any model that has a uniqueness validation, write a test that tries to add a second model with the same value, see that it fails.
  • Using the TDD (test first) style, add a test for a method named fancy? that returns true if the word has more than 16 characters. Make sure that it also returns false for words that aren't fancy
    • Add the test for the new method FIRST
    • Confirm it fails
    • Resolve the message (typically method not defined)
    • Make the method pass

Explorer Mode

  • Add a controller test for your search feature.
    • Validate that the correct instance variables are assigned.
    • Add some sample data (fixtures or factories -- see class notes) and validate that the instance variables have what you expect them to have populated
  • If the search is implemented inside the controller, extract the implementation into a class method on your model.
    • Add a unit test for this newly created method.

Epic Mode

  • Add an integration test that validates the correct results are returned when performing a search. NOTE: You will probably need to create more than one definition in your database for this.
  • Add an integration test that validates:
    • There is a link on the homepage to create a new word
    • Requesting that link shows a form
    • Submitting a request to the app with the appropriate data for creating a word puts that definition in the database
    • Once submitted you are redirected to the main page and that word is there

Resources

@byronroark
Copy link
Owner

Still need help completing search tests for word and meaning using factory girl
https://github.com/byronroark/dictionary

@gstark
Copy link
Author

gstark commented Oct 19, 2015

Awesome Work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants