Sha256: 20e457302b5eb1606afa1258064d84e39ac1946b472e417213be7c33a5946d5b

Contents?: true

Size: 1.82 KB

Versions: 10

Compression:

Stored size: 1.82 KB

Contents

require 'spec_helper' 
require 'generator-spec'

require_generator :cancan => :licenses

RSpec::Generator.configure do |config|
  config.debug = true
  config.remove_temp_dir = true #false
  config.default_rails_root(__FILE__) 
  config.lib = File.dirname(__FILE__) + '/../lib'
  config.logger = :stdout  # :file
end


describe 'Licenses generator' do   
  use_helpers :controller, :special, :file
    
  setup_generator :licenses do
    tests Cancan::Generators::LicensesGenerator
  end

  describe "Licenses: Profile Administration and Article Editing" do
    before :each do
      @generator = with_generator do |g|    
        g.run_generator "profile_administration article_editing --no-default-licenses".args
      end
    end

    it "should have created license files" do
      @generator.should have_license_files :profile_administration, :article_editing
       @generator.should_not have_license_files :blogging, :user_admin
    end    
  end

  describe "Licenses: Profile Administration and Article Editing" do
    before :each do
      @generator = with_generator do |g|    
        g.run_generator "profile_administration article_editing".args
      end
    end

    it "should have created license files" do
      @generator.should have_license_files :profile_administration, :article_editing, :blogging, :user_admin
    end
    
    it "should have created license file :profile_administration with the right class" do      
      @generator.should have_license_file :profile_administration do |license|
        license.should have_license_class :profile_administration
      end
    end
    
    it "should have created license file :article_editing with the right class" do      
      @generator.should have_license_file :article_editing do |license|      
        license.should have_license_class :article_editing
      end
    end
  end  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cancan-permits-0.3.12 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.11 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.10 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.9 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.8 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.7 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.6 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.5 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.4 spec/generators/cancan/licenses_generator_spec.rb
cancan-permits-0.3.2 spec/generators/cancan/licenses_generator_spec.rb