From 465dd9ba96e93a197519c83c4ec3e0c4e3301fde Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Wed, 19 Jan 2011 13:30:12 -0800
Subject: [PATCH] check to see if rails is already loaded in a couple of places

---
 db/schema.rb               | 13 +++++++++++++
 features/support/env.rb    |  2 +-
 features/support/server.rb |  2 +-
 lib/tasks/rspec.rake       |  2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/db/schema.rb b/db/schema.rb
index 24f66bf5ce..83c673a0f3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -66,6 +66,19 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
   add_index "contacts", ["user_id", "pending"], :name => "index_contacts_on_user_id_and_pending"
   add_index "contacts", ["user_id", "person_id"], :name => "index_contacts_on_user_id_and_person_id", :unique => true
 
+  create_table "histories", :force => true do |t|
+    t.string   "message"
+    t.string   "username"
+    t.integer  "item"
+    t.string   "table"
+    t.integer  "month",      :limit => 2
+    t.integer  "year",       :limit => 8
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  add_index "histories", ["item", "table", "month", "year"], :name => "index_histories_on_item_and_table_and_month_and_year"
+
   create_table "invitations", :force => true do |t|
     t.text     "message"
     t.integer  "sender_id"
diff --git a/features/support/env.rb b/features/support/env.rb
index 45008cdf07..b59524cce4 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -5,7 +5,7 @@
 # files.
 
 ENV["RAILS_ENV"] ||= "test"
-require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') unless defined?(Rails)
 
 require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
 require 'cucumber/rails/rspec'
diff --git a/features/support/server.rb b/features/support/server.rb
index 8a9cf5c9a8..90b90c7287 100644
--- a/features/support/server.rb
+++ b/features/support/server.rb
@@ -1,6 +1,6 @@
 
 ENV["RAILS_ENV"] ||= "test"
-require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') unless defined?(Rails)
 
 require 'timeout'
 require 'socket'
diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake
index 47d1a37edc..a82909b4fe 100644
--- a/lib/tasks/rspec.rake
+++ b/lib/tasks/rspec.rake
@@ -12,7 +12,7 @@ rescue MissingSourceFile
         def initialize(name)
           task name do
             # if rspec-rails is a configured gem, this will output helpful material and exit ...
-            require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
+            require File.expand_path(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
 
             # ... otherwise, do this:
             raise <<-MSG
-- 
GitLab