Sha256: 2d82c74bc090bebb5da611869f0083930bb61964b399e7762ed77aae55e28cbd
Contents?: true
Size: 776 Bytes
Versions: 20
Compression:
Stored size: 776 Bytes
Contents
require 'generators/rspec' require_relative '../../ability_definition' module Rspec module Generators class AbilityGenerator < Base @_rspec_source_root = File.expand_path('../templates', __FILE__) argument :ability_definitions, :type => :array, :default => [], :banner => "can:abilities:models cannot:abilities:models" def generate_ability_spec template "abilities_spec.rb.erb", "spec/abilities/#{file_name.pluralize}_spec.rb" end private def definitions(&block) ability_definitions.each { |definition| AbilityDefinition.parse(definition) } AbilityDefinition.models.sort.each do |model, definition| yield model, definition end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems