Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “subdomain

Testing with Subdomain_Fu

I’m using Subdomain_Fu and was having issues because I didn’t know how to specify the current_subdomain.

Then I found this post on StackOverflow (Groxx): http://stackoverflow.com/questions/1143129/getting-cucumber-subdomain-fu-to-play-nice-together

I added this to the top of my RSpec specs:

def in_subdomain(str)
@request.host = “#{str}.test.host”
end

then I set my subdomains in each test with the in_subdomain method:

it “should find index” do
in_subdomain(whatever your subdomain is)
get :index
end

 

Advertisements

Subdomains, Locally

In order to make subdomains work locally, I had to change my local host files to map the url correctly (used subdomain fu gem).

Here’s how to find the hosts file (c:\windows\system32\drivers\etc\hosts):
http://uk.answers.yahoo.com/question/index?qid=20100311092531AA0YAe6

 


Subdomains

here are some tutorials on making subdomains work in Rails 3.0

http://railscasts.com/episodes/221-subdomains-in-rails-3

 

http://bcardarella.com/post/716951242/custom-subdomains-in-rails-3

 

if you want to test this locally, you need to edit your hosts file:

 

for windows users: http://www.ehow.com/how_5225562_edit-windows-hosts-file.html