The following spec works for the first example but not the second.
require 'rspec'
require 'capybara/rspec'
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
Capybara.run_server = false
Capybara.current_driver = :seleniumCapybara.app_host = '<some url>'
describe 'page <some page 1>', type: :feature do
it 'redirects to /' do
visit('<some page 1>');
expect(page.current_path).to eq '/'
end
end
describe 'page <some page 2>', type: :feature do
it 'redirects to /' do
visit('<some page 2>');
expect(page.current_path).to eq '/'
end
end
Results are:
rspec spec/redirect_spec.rb
.
An error occurred in an after hook
ArgumentError: rack-test requires a rack application, but none was given
occurred at /home/cb/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.4.4/lib/capybara/rac
k_test/driver.rb:16:in `initialize'
F
Failures:
1) redirect page <some page 2> redirects to /
Failure/Error: visit('< some page 2>');
ArgumentError:
rack-test requires a rack application, but none was given
# ./spec/redirect_spec.rb:21:in `block (2 levels) in <top (required)>'
Finished in 6.52 seconds (files took 0.3075 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./spec/redirect_spec.rb:20 # redirect <some page 2> redirects to /
Clearly I haven't set up right for rack and I haven't found documentation on 3.2. on the subject so I'm am in the dark.
Would appreciate any assistance with solving the problem