Sha256: 6e808d57d1009a33a3b22a79566dc3cb4a5b630e8b9fa82ffe3d0f8d72c8b803

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'configure_helper'

class Role  
  attr_accessor :name
  
  def initialize name
    self.name = name
  end
  
  def self.all
    [Role.new('admin'), Role.new('guest')]
  end
end

require 'cream/role'
require 'cream/configure'

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, :local_host, :auth_label
        :controller.should be_extended_with Cream::Link, :session, :registration, :rest, :session
      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

2 entries across 2 versions & 1 rubygems

Version Path
cream-0.6.0 spec/cream/configure/rails_spec.rb
cream-0.5.10 spec/cream/configure/rails_spec.rb