Changeset 862

Show
Ignore:
Timestamp:
11/06/07 05:21:19 (1 year ago)
Author:
has.s..@gmail.com
Message:

Update for resource generator. Do not use this revision. A File needs to be renamed in next release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/generators/merb_generator_helpers.rb

    r824 r862  
    282282          m.directory "app/helpers/" 
    283283          m.template "helper.rb", "app/helpers/#{file_name}_helper.rb" 
    284           m.dependency @test_generator, [name], :destination => destination_root 
     284          m.dependency @test_generator, [name], :destination => destination_root, :template_actions => @template_actions 
    285285        end 
    286286      end 
  • trunk/rspec_generators/merb_controller_test/merb_controller_test_generator.rb

    r861 r862  
    44  default_options :author => nil 
    55   
    6   attr_reader :name, :class_name, :file_name 
     6  attr_reader :name, :class_name, :file_name, :template_actions 
    77   
    88  def initialize(runtime_args, runtime_options = {}) 
     
    1212    @class_name = @name.camel_case 
    1313    @file_name = @name.snake_case.pluralize 
     14    @template_actions = runtime_options[:template_actions] || [] 
     15    @engine = runtime_options[:engine] || "erb" # set by subclasses only 
    1416    extract_options 
    1517  end 
     
    2123       
    2224      m.directory "spec/views/#{file_name}" 
    23       m.template "view_spec.rb", "spec/views/#{file_name}/index_html_spec.rb" 
     25       
     26       
     27      # Setup the view stubs for each view 
     28      @template_actions.each do |the_action|   
     29        template_name = "#{the_action}.html.#{@engine}" 
     30        if File.exists?(File.join(MERB_ROOT, "app", "views", file_name, template_name)) 
     31          m.template "#{the_action}_spec.rb", "spec/views/#{file_name}/#{the_action}_html_spec.rb" 
     32        end 
     33      end 
     34       
    2435       
    2536      m.directory 'spec/helpers' 
  • trunk/rspec_generators/merb_controller_test/templates/helper_spec.rb

    r861 r862  
    11require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') 
    22 
    3 describe <%= class_name.pluralize %>Helper do 
     3describe Merb::<%= class_name.pluralize %>Helper do 
    44 
    55end