Sha256: e65a6805d2319f3a0e34c33219a769c1ab7e418543a106c12652a946e36c5c67

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

class FunctionalTestGenerator < RubiGen::Base
  
  attr_reader :name, :dist_name
  
  def initialize(runtime_args, runtime_options = {})
    super
    usage if args.empty?
    @name = args.shift
    @dist_name = args.shift || base_name
    extract_options
  end

  def manifest
    record do |m|
      # Ensure appropriate folder(s) exists
      m.directory 'test/functional'

      # Create stubs
      m.template "test/test.html.erb",  "test/functional/#{name}_test.html"
    end
  end

  protected
    def banner
      <<-EOS
Creates a functional test file for the final distribution JavaScript file(s).

USAGE: #{$0} #{spec.name} name [dist_name]

NOTES:
* name - creates a file test/functional/name_test.html
* dist_name - is for a file dist/base_name.js or dist/dist_name.js

EOS
    end

    def add_options!(opts)
      # opts.separator ''
      # opts.separator 'Options:'
      # For each option below, place the default
      # at the top of the file next to "default_options"
      # opts.on("-a", "--author=\"Your Name\"", String,
      #         "Some comment about this option",
      #         "Default: none") { |options[:author]| }
      # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
    end
    
    def extract_options
      # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
      # Templates can access these value via the attr_reader-generated methods, but not the
      # raw instance variable value.
      # @author = options[:author]
    end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
newjs-1.3.0 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.1 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.2 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.4 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.5 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.6 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.3 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.3.7 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.4.0 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.4.1 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.5.0 javascript_test_generators/functional_test/functional_test_generator.rb
newjs-1.5.1 javascript_test_generators/functional_test/functional_test_generator.rb