Comments (17)
@chibicode Hey, I'm sorry about this trouble. Can you please paste here your routes? Thank you!
from hanami.github.io.
@jodosha, thanks for a quick reply! Should be the same as the one on the tutorial...
get '/books', to: 'books#index'
get '/', to: 'home#index'
from hanami.github.io.
Here's the repo (run bundle install
and rake test
to see the failure)
https://github.com/chibicode/lotus-bookshelf
from hanami.github.io.
@chibicode I did exactly what you've asked, but didn't got any failure.
➜ bundle exec rake
Run options: --seed 5405
# Running:
....
Finished in 0.017537s, 228.0925 runs/s, 285.1157 assertions/s.
4 runs, 5 assertions, 0 failures, 0 errors, 0 skips
Can you please paste here the stack trace? Thank you!
from hanami.github.io.
hmm sorry I can't figure out why... :(
❯ rake test
Run options: --seed 11830
# Running:
E...
Finished in 0.020582s, 194.3465 runs/s, 194.3465 assertions/s.
1) Error:
List books#test_0001_displays each book on the page:
Capybara::ElementNotFound: Unable to find css "#books"
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/node/finders.rb:43:in `block in find'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/node/base.rb:84:in `synchronize'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/node/finders.rb:32:in `find'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/session.rb:698:in `block (2 levels) in <class:Session>'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/session.rb:287:in `within'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.5.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
/Users/shu/code/_cloned/bookshelf/spec/web/features/list_books_spec.rb:7:in `block (2 levels) in <top (required)>'
4 runs, 4 assertions, 0 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:spec" -I"/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib" "/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb" "spec/**/*_spec.rb" ]
Tasks: TOP => test
(See full trace by running task with --trace)
also:
❯ bundle exec lotus server
[2016-01-15 00:53:02] INFO WEBrick 1.3.1
[2016-01-15 00:53:02] INFO ruby 2.2.0 (2014-12-25) [x86_64-darwin14]
[2016-01-15 00:53:02] INFO WEBrick::HTTPServer#start: pid=5558 port=2300
::1 - - [15/Jan/2016:00:53:13 -0800] "GET /books HTTP/1.1" 404 23 0.8271
::1 - - [15/Jan/2016:00:53:30 -0800] "HEAD /books HTTP/1.1" 404 23 0.6562
[2016-01-15 00:53:30] ERROR Rack::Lint::LintError: Response body was given for HEAD request, but should be empty
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/lint.rb:20:in `assert'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/lint.rb:688:in `verify_content_length'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/lint.rb:716:in `each'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/body_proxy.rb:31:in `each'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:112:in `service'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/shu/.rbenv/versions/2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
::1 - - [15/Jan/2016:00:53:35 -0800] "HEAD /books/ HTTP/1.1" 200 - 0.7040
❯ curl -I http://localhost:2300/books
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 23
X-Cascade: pass
Server: WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25)
Date: Fri, 15 Jan 2016 08:53:30 GMT
Connection: close
❯ curl -I http://localhost:2300/books/
HTTP/1.1 200 OK
Server: WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25)
Date: Fri, 15 Jan 2016 08:53:35 GMT
Content-Length: 0
Connection: Keep-Alive
also:
❯ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
also:
❯ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
dotenv (2.1.0)
http_router (0.11.2)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
lotus-assets (0.1.0)
lotus-helpers (~> 0.2, >= 0.2.5)
lotus-utils (~> 0.6)
tilt (~> 2.0, >= 2.0.2)
lotus-controller (0.5.0)
lotus-utils (~> 0.6)
lotus-validations (~> 0.4)
rack (~> 1.6, >= 1.6.2)
lotus-helpers (0.2.6)
lotus-utils (~> 0.6)
lotus-mailer (0.1.0)
lotus-utils (~> 0.5)
mail (~> 2.5)
tilt (~> 2.0, >= 2.0.1)
lotus-model (0.5.1)
lotus-utils (~> 0.6)
sequel (~> 4.9)
lotus-router (0.5.0)
http_router (~> 0.11)
lotus-utils (~> 0.6)
lotus-utils (0.6.0)
lotus-validations (0.4.0)
lotus-utils (~> 0.6)
lotus-view (0.5.0)
lotus-utils (~> 0.6)
tilt (~> 2.0, >= 2.0.1)
lotusrb (0.6.0)
bundler (~> 1.6)
dotenv (~> 2.0)
lotus-assets (~> 0.1)
lotus-controller (~> 0.5)
lotus-helpers (~> 0.2, >= 0.2.6)
lotus-mailer (~> 0.1)
lotus-router (~> 0.5)
lotus-utils (~> 0.6)
lotus-view (~> 0.5)
shotgun (~> 0.9)
thor (~> 0.19)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.99)
mini_portile2 (2.0.0)
minitest (5.8.3)
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
pg (0.18.4)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rake (10.5.0)
sequel (4.30.0)
shotgun (0.9.1)
rack (>= 1.0)
thor (0.19.1)
tilt (2.0.2)
url_mount (0.2.1)
rack
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bundler
capybara
lotus-model (~> 0.5)
lotusrb (= 0.6.0)
minitest
pg
rake
from hanami.github.io.
@chibicode Our Gemfile.lock
files are identical:
➜ diff Gemfile.lock GGemfile.lock
84a85
>
from hanami.github.io.
@chibicode However, I found something really interesting:
# spec/web/features/list_books_spec.rb
require 'features_helper'
describe 'List books' do
it 'displays each book on the page' do
visit '/books'
# NEW ASSERTION
current_path.must_equal '/books'
within '#books' do
assert page.has_css?('.book', count: 2), "Expected to find 2 books"
end
end
end
If I run again the tests, I've got an odd failure:
➜ bundle exec rake
Run options: --seed 37441
# Running:
..F.
Finished in 0.016184s, 247.1580 runs/s, 308.9475 assertions/s.
1) Failure:
List books#test_0001_displays each book on the page [/Users/luca/Desktop/lotus-bookshelf/spec/web/features/list_books_spec.rb:7]:
Expected: "/books"
Actual: "//books"
4 runs, 5 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:spec" -I"/Users/luca/.gem/ruby/2.3.0/gems/rake-10.5.0/lib" "/Users/luca/.gem/ruby/2.3.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb" "spec/**/*_spec.rb" ]
Tasks: TOP => default => test
(See full trace by running task with --trace)
Can you please try yourself?
from hanami.github.io.
@jodosha I just edited and added the stack trace for bundle exec lotus server
on the comment above just in case you didn't see it.
The strange thing is, if I change the route to something like
get '/foo', to: 'books#index'
Then /foo
(without trailing slash) works fine.
❯ cat apps/web/config/routes.rb
get '/foo', to: 'books#index'
# Configure your routes here
# See: http://www.rubydoc.info/gems/lotus-router/#Usage
get '/', to: 'home#index'
❯ curl -I http://localhost:2300/foo
HTTP/1.1 200 OK
Server: WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25)
Date: Fri, 15 Jan 2016 09:00:42 GMT
Content-Length: 0
Connection: Keep-Alive
from hanami.github.io.
Can you please try yourself?
Sure let me take a look.
from hanami.github.io.
For me, current_path
actually works and the error is on the same line as before. I commented out the last assertion:
Then the test passes:
from hanami.github.io.
I tried puts'ing page.body
from hanami.github.io.
Let me know if there are other ways I might be able to debug the request!
from hanami.github.io.
With trailing slash:
from hanami.github.io.
I also ran into this issue.
visit '/books/'
current_path.must_equal '/books/'
Results in:
Minitest::Assertion: Expected: "/books/"
Actual: "//books/"
from hanami.github.io.
We have identified the issue and now working a patch. We will update on the status asap.
from hanami.github.io.
It has been addressed in ver 0.7.1
from hanami.github.io.
👍
from hanami.github.io.
Related Issues (20)
- Add information about #project method (models)
- Docs improvement HOT 6
- Syntax highlighting bug HOT 1
- Guide: sessions is misleading regarding custom session adapters
- Broken links HOT 2
- Better to add ".one" at the end for queries which uses limit
- Incomplete guide share code of views
- Add Guide for Deploying
- Doc: fix code in Guides/1.1/Architecture/Interactors
- Update search to only show newest version HOT 4
- GS Guide: Hanami 1.2 test count is different HOT 1
- Algolia search HOT 6
- Announcing Hanami v1.2.0 - buttons share & tweet don't working HOT 2
- Guides returns incorrect version
- Google search results are dead HOT 3
- Atom feed is broken
- Hanami security page is broken HOT 4
- Disable HTTP and redirect to HTTPS? HOT 4
- Maling List sign up is broken
- Write 2.1.0.rc1 release blog post
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hanami.github.io.