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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Change Getting Started to use RSpec #429

Closed
wants to merge 9 commits into from

Conversation

cllns
Copy link
Member

@cllns cllns commented Jan 10, 2018

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 :) 馃尭

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.
Copy link
Collaborator

@oana-sipos oana-sipos Jan 23, 2018

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.
Copy link
Collaborator

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?

@oana-sipos
Copy link
Collaborator

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 .md, both editors and renderers know how to print it as part of the next line. Please ping me if it's unclear ;) Otherwise, nice job @cllns!

@cllns
Copy link
Member Author

cllns commented Jan 23, 2018

@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.

@oana-sipos
Copy link
Collaborator

@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`.
Copy link
Member

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

@jodosha jodosha assigned jodosha and cllns and unassigned jodosha Oct 23, 2018
@jodosha
Copy link
Member

jodosha commented Oct 23, 2018

@cllns Thanks for this PR. The contents has been ported to hanami/guides#3

@jodosha jodosha closed this Oct 23, 2018
@jodosha jodosha deleted the change-getting-started-to-rspec branch October 23, 2018 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants