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.
On Wednesday, May 2, 2012 11:54:50 AM UTC+1, Rainer Kuhn wrote:
> 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:
> > I'd try running the Rack app and using curl -i to see exactly what it
> returns.
> > /Jonas
> > On Tue, May 1, 2012 at 9:09 PM, Rainer Kuhn <rai...@incutio.com> wrote:
> > > 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
> > > ```