Sha256: 739d7d8b4d43abab1a3d61697a8b808ca489a15f742b36d14b55d154b6a17fd0

Contents?: true

Size: 768 Bytes

Versions: 6

Compression:

Stored size: 768 Bytes

Contents

module Oojs
  module Generators
    class SpecGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
      argument :spec_name, :type => :string

      def create_spec
        template 'spec.js.coffee.erb', "spec/javascripts/#{file_name}_spec.js.coffee"
      end

      def create_spec_main
        template 'spec_main.js.coffee.erb', "spec/javascripts/#{file_name}/main.js.coffee"
      end

      def create_fake_ajax_server
        template 'fake_ajax_server.js.coffee.erb', "spec/javascripts/#{file_name}/fake_server.js.coffee"
      end

      private

      def file_name
        @file_name ||= spec_name.underscore
      end

      def class_name
        @class_name ||= spec_name.camelize
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
oojs-0.3.0 lib/generators/oojs/spec/spec_generator.rb
oojs-0.2.3 lib/generators/oojs/spec/spec_generator.rb
oojs-0.2.2 lib/generators/oojs/spec/spec_generator.rb
oojs-0.2.1 lib/generators/oojs/spec/spec_generator.rb
oojs-0.2.0 lib/generators/oojs/spec/spec_generator.rb
oojs-0.1.1 lib/generators/oojs/spec/spec_generator.rb