biola / rack-cas

Rack-CAS is simple Rack middleware to perform CAS client authentication.
MIT License
149 stars 76 forks source link

Rspec / Capybara #83

Open ddavisgraphics opened 6 years ago

ddavisgraphics commented 6 years ago

I think I'm getting this error because of fake cas. The URI and routes work on the local application, it works when testing the routes themselves, and I get 302 redirects in request tests. However the way to test in a feature test which is depicted in the documentation is not working.

  1) Admins requires to be signed in as an admin
     Failure/Error: visit '/login'

     URI::InvalidURIError:
       bad URI(is not URI?):
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:59:in `process'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:51:in `block in process_and_follow_redirects'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:46:in `times'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:46:in `process_and_follow_redirects'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:23:in `visit'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/driver.rb:45:in `visit'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/session.rb:269:in `visit'
     # /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
     # ./spec/features/admins_spec.rb:6:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # NoMethodError:
     #   undefined method `to_str' for nil:NilClass
     #   /usr/local/bundle/gems/capybara-3.4.1/lib/capybara/rack_test/browser.rb:59:in `process'
adamcrown commented 5 years ago

Hi @ddavisgraphics. Sorry for the very long delay in getting back to you on this. I'm gonna try to stay on top of these things better going forward. Are you still having this problem? If you could provide the code that's failing in that admins_spec.rb file, that would be helpful. Thanks.

ddavisgraphics commented 5 years ago

Looking back at the code, it appears that we skipped testing for the test environment because we couldn't get a mock authentication to work.