Created
August 17, 2015 12:20
-
-
Save migimunz/97549f11b8714a5aa17c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Redirects controller: | |
class RedirectsController < ApplicationController | |
def create | |
redirect_to "http://www.google.com" | |
end | |
end | |
### Routes | |
Rails.application.routes.draw do | |
root 'pages#index' | |
get 'redirect', :to => 'redirects#create' | |
end | |
### The spec | |
require 'spec_helper' | |
describe 'RedirectsController' do | |
describe "#create", sidekiq: :fake do | |
before { Sidekiq::Worker.clear_all } | |
describe "when called with a mmm and url" do | |
it 'queues open worker' do | |
visit "/redirect" | |
end | |
end | |
end | |
end | |
### The error: | |
Failure/Error: visit "/redirect" | |
Capybara::InfiniteRedirectError: | |
redirected more than 5 times, check for infinite redirects. | |
# /home/migimunz/.rvm/gems/ruby-2.2.1@tracker/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:40:in `process_and_follow_redirects' | |
# /home/migimunz/.rvm/gems/ruby-2.2.1@tracker/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:21:in `visit' | |
# /home/migimunz/.rvm/gems/ruby-2.2.1@tracker/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:42:in `visit' | |
# /home/migimunz/.rvm/gems/ruby-2.2.1@tracker/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit' | |
# /home/migimunz/.rvm/gems/ruby-2.2.1@tracker/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' | |
# ./spec/routing/clicks_controller_spec.rb:13:in `block (4 levels) in <top (required)>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment