Thanks for the reply, James.

El 13/2/2009, a las 16:28, James Byrne <li...@ruby-forum.com> escribió:

You could consider moving your spec_helper method into a separate
library module, put that in /lib and load it in
config/environments/test.rb.

Moving the hack from the spec_helper.rb file into a different file unfortunately doesn't make it any less of a kludge...

You can also look at:

http://www.subelsky.com/2007/11/testing-rails-ssl-requirements-on-your.html

for ideas, although I do not think that his approach will tie into
cucumber.

That article is about setting up a local Apache instance to proxy to a local Mongrel instance so that you can connect via HTTPS in local, manual testing on your development machine. I actually already do that (although I am using nginx, not Apache), but that really has nothing to do with RSpec or Cucumber because unless you're doing in-browser testing with Selenium or similar you're not actually making an HTTP/ HTTPS connection at all.

Nevertheless, that article led me to this one:

  
http://www.ricroberts.com/articles/2008/09/25/setting-up-ssl-for-rails-and-testing-it-locally

Which itself had a hideous suggestion in it that actually works around my problem. Basically the advice consists of doing something like this in your "ssl_required?" method in your application_controller.rb:

  # always return false for tests
  return false if RAILS_ENV == 'test'

I brand this as "hideous" because it commits the heinous crime of dynamically modifying application behaviour only when execution within the testing context is detected. Ugh.

For the time being, though, looks like the only way to get my Cucumber features working. At least until I find out a better way.

Cheers,
Wincent



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to