Sha256: a2a40d9df97278558ab71c3a05b5ce1f4d16fe7b3a75ac4fca703171956329f2

Contents?: true

Size: 1002 Bytes

Versions: 8

Compression:

Stored size: 1002 Bytes

Contents

require 'generator_spec_helper'
require_generator :roles_model => :roles

describe 'helper_generator' do
  let(:strategy) { 'role_string' }
  
  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 'role_string' 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 :roles, :args => ':admin, :user'
        clazz.should have_call :role_strategy, :args => ":#{strategy}"        
      end
    end
  end
end



Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
roles_generic-0.2.7 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.6 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.5 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.4 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.3 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.2 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.1 spec/generators/role_string_generator_spec.rb
roles_generic-0.2.0 spec/generators/role_string_generator_spec.rb