views:

2

answers:

0

Iam creating an application where a user can have many organisations each organisation has it's own data, things work fine on development, but when I'm in test mode it doesn't work. For example I have a class Tax

class Tax < ActiveRecord::Base
  # This shouln't be neccesary according to documentation
  before_create :set_organisation_id

  default_scope where(:organisation_id => OrganisationSession.organisation_id)

  private
  def set_organisation_id
    self.organisation_id = OrganisationSession.organisation_id
  end
end

I'm using Steak as my acceptance testing framework. What can I do to resolve this problem. And please don't tell me not to use default_scope