Sha256: 10b787e1d91fccd748b086ddd81202e43588a6a61e00b0efbd468824a03799ce

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require 'configure_helper'

require 'cream/configure/rails'

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
      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        
      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

9 entries across 9 versions & 1 rubygems

Version Path
cream-0.9.2 spec/cream/configure/rails_role_spec.rb
cream-0.9.1 spec/cream/configure/rails_role_spec.rb
cream-0.9.0 spec/cream/configure/rails_role_spec.rb
cream-0.8.9.3 spec/cream/configure/rails_role_spec.rb
cream-0.8.9.2 spec/cream/configure/rails_role_spec.rb
cream-0.8.9.1 spec/cream/configure/rails_role_spec.rb
cream-0.8.9 spec/cream/configure/rails_role_spec.rb
cream-0.8.8 spec/cream/configure/rails_role_spec.rb
cream-0.8.7 spec/cream/configure/rails_role_spec.rb