davydovanton / rspec-hanami

RSpec Matchers for Hanami
MIT License
46 stars 8 forks source link

Fixed RequestHelpers::Request #env #15

Closed ikzekly closed 6 years ago

ikzekly commented 6 years ago

Faced a some issue with ENV['PATH_INFO']. RequestHelpers::Request#env method returned ["/", "GET", "?"]:Array for ENV['PATH_INFO']. Gives it to Hanami#app. And i'll get exception, when hanami initialize assets and check path for start_with? in hanami-1.2.0/lib/hanami/assets/asset.rb:35:

Failures:

  1) Visit home
     Failure/Error: it { expect(get('/')).to be_success }

     NoMethodError:
       undefined method `start_with?' for ["/", "GET", "?"]:Array
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/asset.rb:35:in `block in initialize'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/asset.rb:35:in `each'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/asset.rb:35:in `find'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/asset.rb:35:in `initialize'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/static.rb:43:in `new'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/assets/static.rb:43:in `call'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/rack-2.0.5/lib/rack/content_length.rb:15:in `call'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/hanami-1.2.0/lib/hanami/app.rb:44:in `call'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/rspec-hanami-0.3.0/lib/rspec/hanami/request_helpers.rb:50:in `request'
     # /Users/ilia/.rvm/gems/ruby-2.3.5/gems/rspec-hanami-0.3.0/lib/rspec/hanami/request_helpers.rb:54:in `get'
     # ./spec/web/features/visit_home_spec.rb:4:in `block (2 levels) in <top (required)>'

Finished in 0.01475 seconds (files took 1.58 seconds to load)
2 examples, 1 failure

Failed examples:

rspec ./spec/web/features/visit_home_spec.rb:4 # Visit home

Fixed by commas removed.