Sha256: 6630564485a6a1d0eb0cb15c834fa09bca39c92d8a05d545af6b2b6cb9eddfc2

Contents?: true

Size: 967 Bytes

Versions: 5

Compression:

Stored size: 967 Bytes

Contents

require 'configure_helper'

class User
  def self.roles
    [:guest, :admin]
  end
end

describe "Rails extension" do
  describe 'Extensions' do
    it "should extend Action View with Roles helper instance_methods and specific role methods" do
      after_init :view do
        :view.should be_extended_with Cream::View,    :role, :host, :user_action_menu
        :view.should be_extended_with Cream::Helper,  :role, :auth_label
      end
      
      init_app_railties :minimal, :view
    end

    it "should extend Action Controller" do
      after_init :controller do
        :controller.should be_extended_with Cream, :role
        :controller.should be_extended_with Cream::Controller, :ability
        :controller.should be_extended_with Cream::Helper, :role, :host, :auth_label
      end            
      
      init_app_railties :minimal, :view
    end   
    
    it "should work with safe_concat" do
      "abc".html_safe.should == "abc"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cream-0.7.3 spec/cream/configure/rails_user_roles_spec.rb
cream-0.7.2 spec/cream/configure/rails_user_roles_spec.rb
cream-0.7.0 spec/cream/configure/rails_user_roles_spec.rb
cream-0.6.4 spec/cream/configure/rails_user_roles_spec.rb
cream-0.6.3 spec/cream/configure/rails_user_roles_spec.rb