Story / Redirection to static html within public

With a rails application I’m trying to access the public/ folder from
within a rspec story.

I have a controller which redirects to:

/public/static_html_page.html

I have a story written using webat.
This story uses the above controller and it expects the redirection.

This story always fails as within the story it cannot follow the
redirection (Always gives a 500 error). It does not seem to be able to
access any public/ content within the story.

Within step file of a story this always fails:
‘get /index.html’
OR
visits ‘/index.html’

I looked back at ActionController::IntegrationTest which seems to be
where RailsStory gets all its magic from. That lead me to believe that
perhaps this was a rails issue?

So I’m unsure if:

  1. Accessing public/ within a story is just not supposed to be possible.

  2. Accessing public/ within ActionController::IntegrationTest is not
    suppose to be possible.

  3. Rspec has a bug

  4. Rails has a bug

Any ideas?

This is down on Rails 2.0.2.
Rspec GIT trunk

Thanks,

Joseph W.
http://www.joesniff.co.uk

On 5/22/08, Joseph W. [email protected] wrote:

With a rails application I’m trying to access the public/ folder from
within a rspec story.

I have a controller which redirects to:

/public/static_html_page.html

I assume you mean /static_html_page.html? Your document_root in your
webserver should be set to /public thus you should never see /public
in your URLs,

I have a story written using webat.
This story uses the above controller and it expects the redirection.

This story always fails as within the story it cannot follow the
redirection (Always gives a 500 error). It does not seem to be able to
access any public/ content within the story.

Rails Integration tests talk directly to controllers, since there is
no controller in front of static files there is no way to access them
as far as I’ve seen.

So I’m unsure if:

  1. Accessing public/ within a story is just not supposed to be possible.

Correct

  1. Accessing public/ within ActionController::IntegrationTest is not
    suppose to be possible.

Correct.

  1. Rspec has a bug
  2. Rails has a bug

Any ideas?

We can look at getting webrat to recognize the redirect to file
outside the scope of the rails environment. Patches always welcome of
course.

  • Josh


Josh K.
phone: 509-979-1593
email: [email protected]
web: http://joshknowles.com

I have a story written using webat.

This story uses the above controller and it expects the redirection.

This story always fails as within the story it cannot follow the
redirection (Always gives a 500 error). It does not seem to be able to
access any public/ content within the story.

Rails Integration tests talk directly to controllers, since there is
no controller in front of static files there is no way to access them
as far as I’ve seen.

You can redirect the static files by creating an extra file say some
home.html or index.html and then specifying the path of your next html
file(that you want to forward). From that file onwards the redirection
takes place correctly without looking for controller.
I remind you home.html file must be rendered through controller action
using
render :file=>"…path to html folder"/home.html
I hope this helps.