Sha256: fb47c23a74216c851b664a086d20d5c3aa8f583685829498f104bcc542b59862

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 Bytes

Contents

require File.join(File.dirname(__FILE__), 'named_arg')
require File.join(File.dirname(__FILE__), 'feature_base')

module Cucumber
  class FeatureGenerator < Rails::Generators::NamedBase

    include Cucumber::Generators::FeatureBase
  
    argument :fields, :optional => true, :type => :array, :banner => "[field:type, field:type]"

    attr_reader :named_args
  
    def parse_fields
      @named_args = @fields.nil? ? [] : @fields.map { |arg| NamedArg.new(arg) }
    end    

    def generate
      create_directory
      create_feature_file
      create_steps_file
      create_support_file
    end
  
    def self.banner
      "#{$0} cucumber:feature ModelName [field:type, field:type]"
    end
  
    def self.gem_root
      File.expand_path("../../../../../", __FILE__)
    end
  
    def self.source_root
      File.join(gem_root, 'templates', 'feature')
    end
  
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
cucumber-rails2-0.3.5 lib/generators/cucumber/feature/feature_generator.rb
cucumber-rails2-0.3.4 lib/generators/cucumber/feature/feature_generator.rb
cucumber-rails2-0.3.3 lib/generators/cucumber/feature/feature_generator.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-rails-0.3.2/lib/generators/cucumber/feature/feature_generator.rb
cucumber-rails-0.3.2 lib/generators/cucumber/feature/feature_generator.rb
cucumber-rails-0.3.1 lib/generators/cucumber/feature/feature_generator.rb
cucumber-rails-0.3.0 lib/generators/cucumber/feature/feature_generator.rb