diff options
author | Azul <azul@riseup.net> | 2017-03-20 11:00:28 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-03-20 11:04:44 +0100 |
commit | 32b07d8c98719f3c52a3c5315da1f61c6e35cbd6 (patch) | |
tree | ce9e94b23dc6b838a9e68a96b1d7cc811924f952 /test/support/rack_stack_test.rb | |
parent | d7990f1b2af378ad071db6d94c5f95a50d6b7dcd (diff) |
test: 404 response for missing key
enable testing error responses on the full rack stack.
Diffstat (limited to 'test/support/rack_stack_test.rb')
-rw-r--r-- | test/support/rack_stack_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/support/rack_stack_test.rb b/test/support/rack_stack_test.rb new file mode 100644 index 0000000..eb49d1e --- /dev/null +++ b/test/support/rack_stack_test.rb @@ -0,0 +1,32 @@ +require 'capybara/rails' +# +# RackStackTest +# +# Tests that will use the entire rack stack from capybara. +# +class RackStackTest < ActionDispatch::IntegrationTest + + CONFIG_RU = (Rails.root + 'config.ru').to_s + OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first + + # this is integration testing. So let's make the whole + # rack stack available... + Capybara.app = OUTER_APP + Capybara.run_server = true + Capybara.app_host = 'http://lvh.me:3003' + Capybara.server_port = 3003 + + # WARNING: this creates an error in the test as soon as there + # is an error in rails. Use the javascript driver for testing + # error rendering + Capybara.register_driver :rack_test do |app| + Capybara::RackTest::Driver.new(app) + end + + require 'capybara/poltergeist' + + Capybara.register_driver :poltergeist do |app| + Capybara::Poltergeist::Driver.new(app) + end + +end |