Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Not Following redirects from Rack
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rainer Kuhn  
View profile  
 More options May 1 2012, 3:09 pm
From: Rainer Kuhn <rai...@incutio.com>
Date: Tue, 1 May 2012 12:09:40 -0700 (PDT)
Local: Tues, May 1 2012 3:09 pm
Subject: Not Following redirects from Rack
I'm using capybara with RSpec request specs and can't get it to follow
redirects from a rack app. Any ideas? The action behind the redirect
is never called, current_path shows just the call to the Rack app. Any
ideas?

```ruby
visit "test"
page.should have_content("Testing 123")
```

```ruby
#rack app

def call(env)
  response = Rack::Response.new
  response.redirect("http://.localhost:3000/testpage")
  response.finish
end
```

I get:
```
Capybara::ElementNotFound:
       Unable to find xpath "/html"
```

If I do a simple text only response however it works
```
response = Rack::Response.new("Testing 123")
response.finish
```


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonas Nicklas  
View profile  
 More options May 1 2012, 4:00 pm
From: Jonas Nicklas <jonas.nick...@gmail.com>
Date: Tue, 1 May 2012 22:00:55 +0200
Local: Tues, May 1 2012 4:00 pm
Subject: Re: [Capybara] Not Following redirects from Rack
I'd try running the Rack app and using curl -i to see exactly what it returns.

/Jonas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Kuhn  
View profile  
 More options May 2 2012, 6:54 am
From: Rainer Kuhn <rai...@incutio.com>
Date: Wed, 2 May 2012 03:54:50 -0700 (PDT)
Local: Wed, May 2 2012 6:54 am
Subject: Re: Not Following redirects from Rack
I will, I also suspect that I'm mixing methods from Rack::Test and
Capybara as described here http://elabs.se/blog/34-capybara-and-testing-apis

I have rack APIs, Resque queues and redirects to rails controllers as
a consequence of a single post. I foolishly thought I might just test
them all at once in a big request spec. Apparently that can't be done
yet. The partial tests on each different bit work fine though.

I understand the principle that capybara doesn't do posts and for all
my other specs that works just fine. But what if some forms post from
external sites, or there's a rack app in between. So far there just
isn't a test framework that let's me do an integration test on the
whole process at once.

On May 1, 9:00 pm, Jonas Nicklas <jonas.nick...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Kuhn  
View profile  
 More options May 2 2012, 7:29 am
From: Rainer Kuhn <rai...@incutio.com>
Date: Wed, 2 May 2012 04:29:03 -0700 (PDT)
Local: Wed, May 2 2012 7:29 am
Subject: Re: Not Following redirects from Rack

It's a bit frustrating to see a bunch of passing specs that are only
passing because of side-effects. I'm not even that new to capybara, using
it since 2010 or so. I guess I never really ventured that far into APIs
before and kept close to the views. I now have to go over all the specs
where a 'get', 'post' or 'response.' is mixed  in with 'visit' and
'page.should' and make sure they are actually doing what they are supposed
to.

I guess there is bit of learning todo on my side. The problem is that so
many people call 'post' or even 'page.driver.post' and very often it just
works fine. Then others copy just that from stack overflow. There is hardly
any documentation on the topics, no guideline on how it should be done. I
hope I soon get some company work days dedicated to blogging and maybe even
open source contribution. This would be a good place to start.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »