`current_driver` is a one shot deal and is reset back to the default driver in 
`capybara/rspec` (if I remember correctly), instead set 
`Capybara.default_driver = :selenium` 

Jon Rowe
---------------------------
[email protected]
jonrowe.co.uk


On Tuesday, 28 April 2015 at 15:28, Christopher Biltoft wrote:

> 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
> -- 
> You received this message because you are subscribed to the Google Groups 
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> (mailto:[email protected]).
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rspec/1f4c3169-24a3-43b5-b3a2-9fd6ecf84f57%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/rspec/1f4c3169-24a3-43b5-b3a2-9fd6ecf84f57%40googlegroups.com?utm_medium=email&utm_source=footer).
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/055FCC04FF3B4238AFF29DAEE7ACAB85%40jonrowe.co.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to