2009-11-16 22:28:52 +00:00
|
|
|
require 'rubygems'
|
2010-10-08 18:46:41 +00:00
|
|
|
require 'bundler/setup'
|
2010-12-29 23:01:49 +00:00
|
|
|
|
2012-04-23 00:01:10 +00:00
|
|
|
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
|
2010-12-29 23:01:49 +00:00
|
|
|
|
2010-10-05 17:09:37 +00:00
|
|
|
require 'active_support/all'
|
2010-07-20 23:00:22 +00:00
|
|
|
require 'matchers'
|
2012-04-23 00:01:10 +00:00
|
|
|
require 'cancan'
|
2010-04-13 13:02:39 +00:00
|
|
|
require 'cancan/matchers'
|
2009-11-16 22:28:52 +00:00
|
|
|
|
2010-10-05 17:09:37 +00:00
|
|
|
RSpec.configure do |config|
|
2011-09-28 23:00:46 +00:00
|
|
|
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
|
2009-11-26 17:29:53 +00:00
|
|
|
|
|
|
|
class Ability
|
|
|
|
include CanCan::Ability
|
2010-05-21 20:41:24 +00:00
|
|
|
|
2009-11-26 17:29:53 +00:00
|
|
|
def initialize(user)
|
|
|
|
end
|
|
|
|
end
|
2012-04-23 00:01:10 +00:00
|
|
|
|
|
|
|
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
|