Sha256: 95985f0040ab8997c0179ed6bc9131ff5f5bdeaed0e3b3dc1eec608695c91816

Contents?: true

Size: 1005 Bytes

Versions: 10

Compression:

Stored size: 1005 Bytes

Contents

require 'generator_spec_helper'
require_generator :roles_model => :roles

describe 'helper_generator' do
  let(:strategy) { 'roles_mask' }
  
  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 'roles_mask' 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 :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/roles_mask_generator_spec.rb
roles_generic-0.3.9 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.8 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.7.2 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.7.1 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.7 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.6 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.5 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.4 spec/roles_generic/generators/roles_mask_generator_spec.rb
roles_generic-0.3.3 spec/roles_generic/generators/roles_mask_generator_spec.rb