Skip to content

Commit

Permalink
* Fixed bug in resolving view files for pluralized controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Grafton & Brian Takita committed Dec 16, 2008
1 parent 82d3394 commit 9f6b235
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ erector doesn't have a method built-in, you can still call the element
or empty_element method to output any tag.
* The method instruct!, which was a deprecated synonym for instruct,
has been removed.
* Fixed bug in resolving view files for pluralized controllers

=== 0.5.0 / 2008-12-13
* install_dependencies refreshes the rails_versions directory
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ task(:install_dependencies) do
system("git clone git://github.com/rails/rails.git spec/rails_root/vendor/rails_versions/edge") || raise("Git clone of Rails failed")
FileUtils.mkdir_p(EDGE_PATH)
Rake.application[:refresh_rails_versions].invoke
system("ln -s #{rails_root}/vendor/rails_versions/edge #{rails_root}/vendor/rails")
end

desc "Refreshes the Rails versions from edge git repo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def compile(template)
require_dependency File.expand_path(template.filename)

widget_class_parts = relative_path_parts.inject(['Views']) do |class_parts, node|
class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').classify
class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').camelize
class_parts
end
widget_class_name = widget_class_parts.join("::")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def compile(template)
require_dependency File.expand_path(template.filename)

widget_class_parts = relative_path_parts.inject(['Views']) do |class_parts, node|
class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').classify
class_parts << node.gsub(/^_/, "").gsub(/(\.html)?\.rb$/, '').camelize
class_parts
end
widget_class_name = widget_class_parts.join("::")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Views::TemplateHandlerSpec::TestPage < Erector::Widget
class Views::TemplateHandlerSpecs::TestPage < Erector::Widget
def render_partial
div :class => 'partial' do
text @foo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Views::TemplateHandlerSpecs::TestPage < Erector::Widget
def render
div :class => 'page' do
rawtext(helpers.render(:partial => 'template_handler_specs/test_page', :locals => {:foo => @foo}))
end
end
end
8 changes: 4 additions & 4 deletions spec/rails_root/spec/extensions/template_handler_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require File.expand_path("#{File.dirname(__FILE__)}/../rails_spec_helper")
require "action_controller/test_process"

module TemplateHandlerSpec
module TemplateHandlerSpecs

class TemplateHandlerSpecController < ActionController::Base
class TemplateHandlerSpecsController < ActionController::Base
def index
@foo = "foo"
render :template => "template_handler_spec/test_page.html.rb"
render :template => "template_handler_specs/test_page.html.rb"
end
end

describe ActionView::TemplateHandlers::Erector do
attr_reader :controller, :view, :request, :response
before do
@controller = TemplateHandlerSpecController.new
@controller = TemplateHandlerSpecsController.new

@request = ActionController::TestRequest.new({:action => "index"})
@response = ActionController::TestResponse.new
Expand Down

0 comments on commit 9f6b235

Please sign in to comment.