Sha256: 898dc8c9aee34bb15d69943f5642985c31705793da1c8e41a05a64a19d8f7c3c

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require File.join File.dirname(__FILE__), 'spec_helper'
load File.join File.dirname(__FILE__), 'spec_models.rb'

describe Permissive::PermissionDefinition do
  describe "normalize_scope" do
    it "should normalize an ActiveRecord::Base instance" do
      user = Permissive::User.create!
      Permissive::PermissionDefinition.normalize_scope(user.class, user).should == :permissive_users
    end

    it "should normalize a symbol" do
      user = Permissive::User.create!
      Permissive::PermissionDefinition.normalize_scope(user.class, :foobar).should == :foobars
    end

    it "should normalize a string" do
      user = Permissive::User.create!
      Permissive::PermissionDefinition.normalize_scope(user.class, 'baz').should == :bazs
    end

    it "should normalize a class" do
      user = Permissive::User.create!
      Permissive::PermissionDefinition.normalize_scope(user.class, Permissive::Organization).should == :permissive_organizations
    end

    it "should interpolate a class's name" do
      user = Permissive::User.create!
      Permissive::PermissionDefinition.normalize_scope(user.class, :organizations).should == :permissive_organizations
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
permissive-0.2.9.alpha spec/permission_definition_spec.rb
permissive-0.2.8.alpha spec/permission_definition_spec.rb
permissive-0.2.7.alpha spec/permission_definition_spec.rb
permissive-0.2.6.alpha spec/permission_definition_spec.rb