-
Notifications
You must be signed in to change notification settings - Fork 171
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Change Getting Started to use RSpec #429
Conversation
For now, using `--test=rspec`, but we anticipate to change RSpec to be the default testing framework for Hanami. MiniTest is simpler, but it's less familiar to most people. Additionally, when this was created, Hanami itself used MiniTest. We've since switched over to RSpec, since we needed some of its more powerful features (and it's what most of use most of the time).
Rename "Hanami Architecture" to "Hanami's Architecture", since that's more natural. Also, explain more about the project structure and what `apps` are.
Fix the test syntax to use RSpec's output. Also clarify some other language.
Specifically, refer to them as "Layout templates" instead of just "Layouts", since the latter are a Ruby class in the app.
|
||
We'll store books in our database and let the user manage them with our project. | ||
A first step would be to show a listing of all the books in our system. | ||
|
||
Our first step will be list out all the books we know about. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it more correct to say: Our first step will be to list out... ?
Hanami only has `action` classes, | ||
so a controller is just a module to group several related actions together.)_ | ||
|
||
They files are all pretty much empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you maybe mean these files?
All good as far as I can see at first sight. A minor comment (and maybe just a preference from my side) is not to break a sentence on separate lines in |
@oana-sipos Thanks for the review! The breaks mid-sentence are actually intentional, see this post about 'Semantic Linefeeds'. It helps make git diffs nicer, IMO. It's definitely a preference thing though. |
@cllns thank you for the perspective ;) nice read! |
|
||
Entities are totally unaware of the database. | ||
This makes them **lightweight** and **easy to test**. | ||
|
||
For this reason we need a repository to persist the data that a `Book` depends on. | ||
Since entities are completely decoupled from the database, | ||
we use repositories to persist the data behind a `Book`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add an external link to explain what is the repository pattern.
I have found these one https://martinfowler.com/eaaCatalog/repository.html
@cllns Thanks for this PR. The contents has been ported to hanami/guides#3 |
For now, using
hanami new bookshelf --test=rspec
, but we anticipate to change RSpec to be the default testing framework for Hanami.MiniTest is simpler, but it's less familiar to most people.
Additionally, when this was created, Hanami itself used MiniTest.
We've since switched over to RSpec, since we needed some of its more powerful features (and it's what most of use most of the time).
NOTE: This is not ready to merge. I need to update the code examples from running the test suite, since MiniTest's output is different than RSpec's. I also need to go through the guide again, to make sure I didn't miss anything else. Just thought I'd open this to push myself to finish this sooner, and maybe get another set of eyes on the changes :) 馃尭