Sha256: bf1ff62731d60fdf2030b7268476fe4a83b17f92513a1dcda9cf04ec80d93b73

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# Load application RSpec helper
begin
  require File.dirname(__FILE__) + "/../../../../spec/spec_helper"
rescue LoadError
  puts "Your application hasn't been bootstraped with RSpec.\nI'll do it on my own!\n\n"
  system "cd '#{File.dirname(__FILE__) + "/../../../../"}' && script/generate rspec"
  puts "\n\nRun `rake spec` again."
  exit
end

# Establish connection with in memory SQLite 3 database
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"

# Load database schema
load File.dirname(__FILE__) + "/schema.rb"

# Create an alias for lambda
alias :doing :lambda

# Load resources
require File.dirname(__FILE__) + "/resources/user"
require File.dirname(__FILE__) + "/resources/controllers"

# Restore default configuration
if ENV["TARGET"] == "rails3"
  Rspec.configure do |config|
    config.before :each do
      load File.dirname(__FILE__) + "/../lib/simple_auth/config.rb"
      SimpleAuth::Config.model = :user
    end
  end

  ActionController::Base.prepend_view_path File.dirname(__FILE__) + "/resources/views"
else
  Spec::Runner.configure do |config|
    config.before :each do
      load File.dirname(__FILE__) + "/../lib/simple_auth/config.rb"
      SimpleAuth::Config.model = :user
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_auth-0.1.8 spec/spec_helper.rb
simple_auth-0.1.7 spec/spec_helper.rb