Sha256: 3552fe64608770fa8d925f26e4bfc4e87a37af5138bc9b9d36e6008f2f023270

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

require 'generator_spec_helper'
require_generator :roles_model => :roles

describe 'helper_generator' do
  let(:strategy) { 'many_roles' }
  
  use_orm :active_record
  helpers :model  
    
  before :each do              
    setup_generator 'roles_generator' do
      tests RolesModel::Generators::RolesGenerator
    end    
    remove_model 'user'    
  end

  after :each do
    remove_model 'user'
  end
        
  it "should configure 'many_roles' strategy" do
    create_model :user do
      '# content'
    end
    with_generator do |g|   
      arguments = "User --strategy #{strategy} --roles admin user --orm active_record"
      puts "arguments: #{arguments}"
      g.run_generator arguments.args
      g.should generate_model :user do |clazz|
        clazz.should include_module 'RoleModels::Generic'
        clazz.should have_call :valid_roles_are, :args => ':admin, :user'
        clazz.should have_call :role_class, :args => ':role'        
        clazz.should have_call :strategy, :args => ":#{strategy}"        
      end
    end
  end
end



Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roles_generic-0.5.0 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.9 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.8 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.7.2 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.7.1 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.7 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.6 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.5 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.4 spec/roles_generic/generators/many_roles_generator_spec.rb
roles_generic-0.3.3 spec/roles_generic/generators/many_roles_generator_spec.rb