Sha256: 4fc5940b084893e7aa0e30493874c86d48109c646299890954ee6c16ec0430d0

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

require 'generator_spec_helper'
require_generator :cancan => :config

LOGFILE = 'cancan_config.log'

describe 'Generator' do
  use_helpers :controller, :special, :app, :directory, :file

  before :each do              
    setup_generator 'config_generator' do
      tests CanCan::Generators::ConfigGenerator
    end    
  end

  describe "Configure Rails 3 app for use with CanCan" do
    before do
      Dir.chdir Rails.root do        
        @generator = with_generator do |g|
          arguments = "--logfile #{LOGFILE}".args 
          g.run_generator arguments
        end
      end
    end

    it "should add cancan gems" do
      Rails.root.should have_gems 'cancan', 'cancan-rest-links'
    end

    it "should add CanCan rescue clause to ApplicationController" do
      Rails.root.should have_controller :application do |app_controller|
        puts app_controller
        app_controller.should match /rescue_from CanCan::AccessDenied/
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cream-0.7.0 spec/generators/cancan/config/cancan_config_generator_spec.rb