Sha256: e6439bf19c5fe758fde13c9049bfac3fc151ede78037098d11b2acc44933d06f

Contents?: true

Size: 976 Bytes

Versions: 23

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

23 entries across 23 versions & 1 rubygems

Version Path
cream-0.9.2 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.9.1 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.9.0 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.9.3 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.9.2 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.9.1 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.9 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.8 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.7 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.6 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.5 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.4 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.3 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.2 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.1 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.8.0 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.7.10 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.7.8 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.7.7 spec/generators/cancan/config/cancan_config_generator_spec.rb
cream-0.7.6 spec/generators/cancan/config/cancan_config_generator_spec.rb