cancan/spec/spec_helper.rb

50 lines
980 B
Ruby
Raw Normal View History

2009-11-16 22:28:52 +00:00
require 'rubygems'
require 'bundler/setup'
require "sqlite3"
require "active_record"
case ENV["MODEL_ADAPTER"]
when "data_mapper"
require "dm-core"
require "dm-sqlite-adapter"
require "dm-migrations"
when "mongoid"
require "mongoid"
end
require 'active_support/all'
2010-07-20 23:00:22 +00:00
require 'matchers'
require 'cancan'
2010-04-13 13:02:39 +00:00
require 'cancan/matchers'
2009-11-16 22:28:52 +00:00
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
2009-11-16 22:28:52 +00:00
end
class Ability
include CanCan::Ability
2010-05-21 20:41:24 +00:00
def initialize(user)
end
end
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
class Category < ActiveRecord::Base
connection.create_table(table_name) do |t|
t.boolean :visible
end
has_many :projects
end
class Project < ActiveRecord::Base
connection.create_table(table_name) do |t|
t.integer :category_id
t.string :name
end
belongs_to :category
end