On Monday, 11 April 2011, Pablo L. de Miranda <pablolmira...@gmail.com> wrote:
> Hi guys,
> I'm developing a app where each subdomain has a independent data set.
> I did a few tries to rewrite a test for this, but all were unsuccessful.
> Do someone has a example how I can do that? any reference will help.

In our app, we've used a request spec to specifically check some of
our subdomain-related behaviour:

https://github.com/oneclickorgs/one-click-orgs/blob/master/spec/requests/multi_tenancy_spec.rb

This works by passing full URLs to #get, #post, etc..

The rest of the app specs rely on a method in ApplicationController
which checks the subdomain of the request and does the necessary setup
and data look-up. In the app, this is called in a before_filter on
every action, and in the specs we stub this method to return the
appropriate mock objects.

Hope that gives some guidance.

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

Reply via email to