Sha256: 6d7ba2939c90d02bc09bf959a2fc1f745eab0393d1f266b8967403ed40e3012c

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'configure_helper'

require 'cream/configure'

class Role  
  attr_accessor :name
  
  def initialize name
    self.name = name
  end
  
  def self.all
    [Role.new('admin'), Role.new('guest')]
  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

6 entries across 6 versions & 1 rubygems

Version Path
cream-0.7.3 spec/cream/configure/rails_role_spec.rb
cream-0.7.2 spec/cream/configure/rails_role_spec.rb
cream-0.7.0 spec/cream/configure/rails_role_spec.rb
cream-0.6.4 spec/cream/configure/rails_role_spec.rb
cream-0.6.3 spec/cream/configure/rails_role_spec.rb
cream-0.6.1 spec/cream/configure/rails_spec.rb