Sha256: a9239de9ff17cddfa11ace72fde280b5d57c8fbd2780ce9214944612499f82b6

Contents?: true

Size: 869 Bytes

Versions: 3

Compression:

Stored size: 869 Bytes

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'mocha'

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'has_permission'

# this doesn't seem like the best way to do this - maybe someone will suggest a better method
class Model

  include ActiveRecord::Has::Permission
  
  has_permission
  
  def some_method
    "no permission"
  end
  
  def self.all
    ["no permission"]
  end
  
end

class ModelB
  include ActiveRecord::Has::Permission
  
  has_permission :namespace => ''
end

class ModelBPermission
end

module Permission
  class ModelPermission < Permission::Base
  
    def some_method
      "with permission"
    end
  
    def method_missing(method, *args)
      if method.to_s.match(DEFAULT_FINDERS)
        ["with permission"]
      else
        object.send(method, *args)
      end
    end
  end
end

class Test::Unit::TestCase
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
johnsbrn-has_permission-0.1.1 test/test_helper.rb
johnsbrn-has_permission-0.1.3 test/test_helper.rb
johnsbrn-has_permission-0.1.4 test/test_helper.rb