This repository requires and has been tested on Ruby v3.2.2 and is based on Rails 7.1.2.
RSpec and Shoulda-Matchers have been installed and set up.
- fork this repo
- clone your fork
git clone <repo_name>
cd <repo_name>
bundle install
rails db:{drop,create,migrate,seed}
When you run bundle exec rspec
you should have 2 passing tests.
- Work on this assessment independently. DO NOT discuss with anyone.
- You are allowed to use any references including notes, Google, lesson plans, etc.
- Read each story carefully before you start working.
- Commit Frequently, about every 15 - 30 minutes
- Push your code to your fork once the time is up (not before!)
Once the time for the assessment is up, push your code to your fork and create a pull request to the turingschool-examples
repository. Include the following:
- Your Name
- A reflection on how you felt you did with this challenge and what story you got through
- TDD all new work
- Model methods and relationships must be fully tested.
- Scaffolding is not permitted on this assessment.
- No visual styling is required or expected
- You do not need to test for or create any model validations.
- You are not required too use advanced routing syntax. Any syntax is fine.
Community Garden is an app that tracks Gardens, Plots, and Plants.
-
Gardens have a name and an 'organic' boolean column
- Ex:
name: "Turing Community Garden", organic: true
- Ex:
-
Plots have a number, size, and a direction
- Ex:
number: 25, size: "Large", direction: "East"
- Ex:
-
Plants have a name, description, and days to harvest.
- Ex:
name: "Purple Beauty Sweet Bell Pepper", description: "Prefers rich, well draining soil.", days_to_harvest: 90
- Ex:
-
Gardens have many plots
-
Plots belong to a Garden
-
Plants can be in many Plots
-
Plots have many Plants
Some of the initial migrations and model set up has been done for you.
User Story 1, Plots Index Page
As a visitor
When I visit the plots index page ('/plots')
I see a list of all plot numbers
And under each plot number I see the names of all that plot's plants
User Story 2, Remove a Plant from a Plot
As a visitor
When I visit the plots index page
Next to each plant's name
I see a button to remove that plant from that plot
When I click on that button
I'm returned to the plots index page
And I no longer see that plant listed under that plot,
And I still see that plant's name under other plots that is was associated with.
Note: you do not need to test for any sad paths or implement any flash messages.
User Story 3, Garden's Plants
As a visitor
When I visit a garden's show page ('/gardens/:id')
Then I see a list of plants that are included in that garden's plots
And I see that this list is unique (no duplicate plants)
And I see that this list only includes plants that take less than 100 days to harvest
Extension 1
As a visitor
When I visit a garden's show page,
Then I see the list of plants is sorted by the number of times the plant appears in any of that garden's plots from most to least
(Note: you should only make 1 database query to retrieve the sorted list of plants)