Forum: RSpec redirects while using subdomains not working in 4.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2f030c2a9e4e1e165a0cb360805951f3?d=identicon&s=25 Tom Hoen (hoenth)
on 2009-02-05 20:13
With the great help of David C., Scott T., and Dennis Z., redirecting
while using a sub-domain worked in Dennis' fork:
git://github.com/zdennis/webrat.git.

Unfortunately, after upgrading to 4.1 (so I could use set_hidden_field),
I am getting responses of "You are being redirected" instead of getting
the page that the user was being redirected to.

Did not all of Dennis's changes make it in?

All the best,
Tom
57e939ff00f9df2670a09f417c08da5e?d=identicon&s=25 Josh Knowles (Guest)
on 2009-02-06 00:15
(Received via mailing list)
On Thu, Feb 5, 2009 at 2:13 PM, Tom Hoen <lists@ruby-forum.com> wrote:
> Did not all of Dennis's changes make it in?

As far as I know I merged everything in.  Please feel free to open up
a ticket in lighthouse, and/or startup a thread on the Webrat mailing
list with a specific example of whats going wrong and we'll get it
fixed.  Even better would be a patch which includes a failing
integration test :-)

--
Josh Knowles
phone: 509-979-1593
email:  joshknowles@gmail.com
web:    http://joshknowles.com
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-02-06 04:52
(Received via mailing list)
On Thu, Feb 5, 2009 at 2:13 PM, Tom Hoen <lists@ruby-forum.com> wrote:
> With the great help of David C., Scott T., and Dennis Z., redirecting
> while using a sub-domain worked in Dennis' fork:
> git://github.com/zdennis/webrat.git.
>
> Unfortunately, after upgrading to 4.1 (so I could use set_hidden_field),
> I am getting responses of "You are being redirected" instead of getting
> the page that the user was being redirected to.
>
> Did not all of Dennis's changes make it in?

Were you using one of my branches, and was it working for you?

I just pulled down the latest webrat and installed it on a project
that uses subdomains, and all of the features are still passing.

--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
2f030c2a9e4e1e165a0cb360805951f3?d=identicon&s=25 Tom Hoen (hoenth)
on 2009-02-06 15:12
Zach Dennis wrote:

>
> Were you using one of my branches, and was it working for you?
>
> I just pulled down the latest webrat and installed it on a project
> that uses subdomains, and all of the features are still passing.

Zach -

I was using this fork:
http://github.com/zdennis/webrat/tree/make_current...,
and it was working. I moved to the most recent version of webrat, hoping
to use set_hidden_field, which did not seem to be in your fork.

I would love to help figure out why it is not working for me, but I just
don't know enough about ruby/rails/webrat/mechanize etc yet. Though I
will try to track down what is going wrong, it is unlikely I will find
it.

First, I am going to make sure that I am current on all of the pieces. I
develop on a Vista machine, but run tests on Ubuntu running in VMWare.
It may be that one of the dependencies is out of date (rspec, cucumber,
webrat, etc.).

Currently, I have the following installed:
rspec (1.1.12, 1.1.4)
rspec-rails (1.1.12)
webrat (0.4.0)
hpricot (0.6.161)
cucumber (0.1.16, 0.1.14, 0.1.12)
Rails 2.1.2

The first test that fails is a simple login. After successfully
completing the login (filling in login and password and clicking login),
the user is redirected to their personal page. At this point, Cucumber
is seeing the response as "You are being redirected" instead of
following the redirect. The message contains the correct redirect url,
so I know the login is working.

The first step of my login feature is the following:
visit login_path(:host => "rpems.test")

Any advice you can give would be greatly appreciated.

Tom
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-02-06 18:36
(Received via mailing list)
On Fri, Feb 6, 2009 at 9:12 AM, Tom Hoen <lists@ruby-forum.com> wrote:
> I was using this fork:
> http://github.com/zdennis/webrat/tree/make_current...,

I am pretty certain that the change in this branch never got committed
to webrat. The ticket is still open:

   http://webrat.lighthouseapp.com/projects/10503/tic...

dstar opened a ticket which is related, as in it requires that all
urls are fully qualified, I don't believe it has been committed either
look back at it:

  http://webrat.lighthouseapp.com/projects/10503/tic...

I haven't tried out dstar's patch, but I believe we solve the same
problem, we just do it at different points.

Perhaps Bryan or Josh could look at these. In the meantime I have
pushed an updated branch which includes all of webrat 4.1. Hopefully
in the meantime this will solve the issue for you:

   http://github.com/zdennis/webrat/tree/make_current...

> It may be that one of the dependencies is out of date (rspec, cucumber,
> The first test that fails is a simple login. After successfully
>
> Tom
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-02-06 18:40
(Received via mailing list)
On Fri, Feb 6, 2009 at 10:20 AM, Zach Dennis <zach.dennis@gmail.com>
wrote:
>>
> look back at it:
>
>  http://webrat.lighthouseapp.com/projects/10503/tic...
>
> I haven't tried out dstar's patch, but I believe we solve the same
> problem, we just do it at different points.

Correction -- I believe his problem forces the problem in my ticket to
be solved. I don't know if my patch solves his problem.

>> I would love to help figure out why it is not working for me, but I just
>> rspec (1.1.12, 1.1.4)
>> following the redirect. The message contains the correct redirect url,
>> --
> Zach Dennis
> http://www.continuousthinking.com
> http://www.mutuallyhuman.com
>



--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
57e939ff00f9df2670a09f417c08da5e?d=identicon&s=25 Josh Knowles (Guest)
on 2009-02-06 19:53
(Received via mailing list)
On Fri, Feb 6, 2009 at 10:20 AM, Zach Dennis <zach.dennis@gmail.com>
wrote:

> Perhaps Bryan or Josh could look at these. In the meantime I have
> pushed an updated branch which includes all of webrat 4.1. Hopefully
> in the meantime this will solve the issue for you:
>
>   http://github.com/zdennis/webrat/tree/make_current...

I will dig more into this over the weekend.


--
Josh Knowles
phone: 509-979-1593
email:  joshknowles@gmail.com
web:    http://joshknowles.com
2f030c2a9e4e1e165a0cb360805951f3?d=identicon&s=25 Tom Hoen (hoenth)
on 2009-02-06 20:25
Zach Dennis wrote:

>
> Correction -- I believe his problem forces the problem in my ticket to
> be solved. I don't know if my patch solves his problem.
>

Zach - Thanks for the quick patch

I grabbed your code, but it did not solve the problem. Here is what I am
seeing.

When fully_qualify_current_url is called, it uses current_host to build
the fully qualified url. However, current_host checks whether
current_url has a value (which it doesn't at first) and returns
"www.example.com" as the host. So I am always getting
"http://www.example.com/<action>" as the url. This makes
internal_redirect? return false (as the host in the current_host is
different from that in the response.header("Location").

Looking at the actual response, it has the correct host in the HTTP_HOST
value, but I can't figure out how to get to it (though i continue to
look) and am not sure if it is appropriate to use as a comparison to the
"Location" host.

Any thoughts on this?

Tom
This topic is locked and can not be replied to.