Blog

Testing your Rails Application in Internet Explorer

Placeholder Avatar
Sebastian Porto
February 12, 2013

When developing a Rails application is quite common to do it using MacOS. But at some point you will probably test that your application works well in different versions of Internet Explorer. This blog post explains a way to achieve this easily.

Use Pow on Mac

Pow makes really easy to spin a Rails application on Mac. The easiest way to install Pow is using the powder gem.

bash gem install powder powder install

Then in your project directory run:

bash powder link

After this you should be able to access your application in your browser without doing anything else. For example, if your application directory is called “blog”, your application will be available at “blog.dev”.

Set your computer local IP address as static

You will need to make the IP address of your computer in your local network static, so it doesn’t change every time you connect to your network (e.g. restart).

Go to Setting > Network. Click on the Advance button, in the drop down Configure IPv4 you should select Using DHCP with manual address or Manually.

An example setup will be to select Using DHCP with manual address and adding your desired IP address in the IPv4 Address field. For example if your Subnet Mask is 255.255.255.0 and your router is in 192.168.0.1 you could add 192.168.0.105 as your computer IP address. The last number is up to you as long as it is not used by another device on your local network.

Install a Windows Virtual Machine

Once you have your app running using Pow the next step is to install a virtual machine with Windows on it.

Thankfully Microsoft offers a bunch of testing VMs so you don’t have to pay for a license of Windows. Go here and download a virtual machine that suits your needs, e.g. VMWare Fusion Mac / IE9 - Win7. Virtual Box is free.

Install the virtual machine and run it.

Accessing your Development Site the Easy Way

You can use xip.io to access your development application directly. For example if your application is accessible using Pow at blog.dev and your machine IP is 192.168.0.105 you would access your site using:

blog.192.168.0.105.xip.io

These should work out of the box when using Pow, however it is a bit slow as each request is doing a trip all the way to xip.io and coming back. A faster alternative is to modify the Windows hostfile.

Editing the Windows Host files

In order to have access to your application you will need to tell Internet Explorer how to find it, you will do this by editing a file called hostfile on your Window virtual machine.

If you are using Windows XP, Vista, 7 or 8 (32bit) you will find the hostfile in

c:\Windows\system32\drivers\etc

You will need administrator access to edit this file. Open this file using Notepad and add the following line at the end:

[you.dev.ip.address]    [your_project.dev]

So for example if my development Mac has IP 192.168.0.105 and my application if running at blog.dev with Pow, I will add:

192.168.0.105    blog.dev

Save the file.

Running It

Simply open IE and type your application Pow address as inserted in the hostfile (e.g. blog.dev). That should be it. You now will be able to access your Rails application from within Windows for testing it.