Hanami: Getting started guide doesn't work as expected

Created on 11 May 2018  路  8Comments  路  Source: hanami/hanami

I'm following the Getting started guide here, and I reached the "Following a request" step.

The guide says that running the home page test it should pass, but it doesn't:

> bundle exec rake test
Run options: --seed 58800

# Running:

.F

Finished in 0.009757s, 204.9881 runs/s, 409.9763 assertions/s.

  1) Failure:
Visit home#test_0001_is successful [/home/user/bookshelf/spec/web/features/visit_home_spec.rb:8]:
Expected # encoding: US-ASCII
"" to include "Bookshelf".

2 runs, 4 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1)
/home/user/.asdf/installs/ruby/2.5.1/bin/bundle:23:in `load'
/home/user/.asdf/installs/ruby/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)

And, if I visit the home page, I can't see the "Bookshelf" write. I double checked if I did something wrong but I couldn't find any difference with the code listed in the tutorial. Here is the app code: https://github.com/mdesantis/hanami-demo

Environment

Ruby: 2.5.1
Hanami: 1.2.0

invalid

Most helpful comment

I guess that after 10 years of Rails development my brain is so frozen on some informations that you guys had to tell me twice that I need a .rb file corresponding to a view :D sorry for the misunderstanding, I'll go on with the tutorial :100:

All 8 comments

You don't have the view, only the template (apps/web/views/home/index.rb). It's one additional layer of abstraction if you're coming from Rails ;)

@mdesantis Hi Maurizio 馃憢 . Does @toommz suggestion helps here?

Hello! Sorry but I didn't get the suggestion :-(

You have the template: https://github.com/mdesantis/hanami-demo/blob/master/apps/web/templates/home/index.html.erb, but not the corresponding view.

How did you generate the code?

I guess that after 10 years of Rails development my brain is so frozen on some informations that you guys had to tell me twice that I need a .rb file corresponding to a view :D sorry for the misunderstanding, I'll go on with the tutorial :100:

Hey @jodosha I am also having same issue this is my github url
https://github.com/rahuldwivedi/hanami_demo please have a look on it I don't think I missed any steps given on the doc http://hanamirb.org/guides/1.2/getting-started/

Your view is a template, not a view. Rails and Hanami differ on how they name and refer to "views".

Oh got it Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Defman21 picture Defman21  路  7Comments

vlad-at-work picture vlad-at-work  路  7Comments

nattfodd picture nattfodd  路  9Comments

AlfonsoUceda picture AlfonsoUceda  路  5Comments

mariusz-kowalski picture mariusz-kowalski  路  7Comments