Sha256: b76a22f99795ac35858b7a7d185ea4d3b1b7fa859a7bca630efc2f767cb49112

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 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
      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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cream-0.5.9 spec/cream/configure/rails_spec.rb