Sha256: 65c68b5ebdcbb0e49248a194b2b5963c66ccab4d986dc51e40728f0e0e0a7ba1

Contents?: true

Size: 781 Bytes

Versions: 5

Compression:

Stored size: 781 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

Bundler.require(:default)

require 'supermodel' # shouldn't Bundler do this already?
require 'active_support/all'
require 'matchers'
require 'cancan/matchers'

RSpec.configure do |config|
  config.mock_with :rr
  config.before(:each) do
    Project.delete_all
    Category.delete_all
  end
end

class Ability
  include CanCan::Ability

  def initialize(user)
  end
end

class Category < SuperModel::Base
  has_many :projects
end

class Project < SuperModel::Base
  belongs_to :category
  attr_accessor :category # why doesn't SuperModel do this automatically?

  def self.respond_to?(method, include_private = false)
    if method.to_s == "find_by_name!" # hack to simulate ActiveRecord
      true
    else
      super
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
codeprimate-cancan-1.6.5 spec/spec_helper.rb
corntrace-cancan-1.6.5 spec/spec_helper.rb
cancant-0.0.1.beta2 spec/spec_helper.rb
cancant-0.0.1.beta1 spec/spec_helper.rb
cancat-0.0.1.beta1 spec/spec_helper.rb