Sha256: fb895c45dcfc281f5991bb68c1192135f759dcf96faf708f7ebfd408872902f3

Contents?: true

Size: 639 Bytes

Versions: 5

Compression:

Stored size: 639 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_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

5 entries across 5 versions & 1 rubygems

Version Path
oojs-0.1.0 lib/generators/oojs/spec/spec_generator.rb
oojs-0.0.4 lib/generators/oojs/spec/spec_generator.rb
oojs-0.0.3 lib/generators/oojs/spec/spec_generator.rb
oojs-0.0.2 lib/generators/oojs/spec/spec_generator.rb
oojs-0.0.1 lib/generators/oojs/spec/spec_generator.rb