Skip to content

Commit

Permalink
Add actionview bug report template
Browse files Browse the repository at this point in the history
Introduce Action View bug report templates for contributors to reproduce
issues with failing `ActionView::TestCase` instances.

In addition to rendering ERB with the `inline:` keyword, the sample
tests also include a `Helpers` module to demonstrate how to incorporate
view helpers into the reproduction script.
  • Loading branch information
seanpdoyle committed Nov 10, 2023
1 parent 60d05cd commit d8ea067
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
33 changes: 33 additions & 0 deletions guides/bug_report_templates/action_view_gem.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
source "https://rubygems.org"

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "actionpack", "~> 7.1.0"
gem "actionview", "~> 7.1.0"
end

require "minitest/autorun"
require "action_view"

class BuggyViewTest < ActionView::TestCase
module Helpers
def upcase(value)
value.upcase
end
end

def test_stuff
view.extend Helpers

render inline: <<~ERB, locals: { key: "value" }
<p><%= upcase(key) %></p>
ERB

assert_includes rendered.html.at("p").text, "VALUE"
end
end
32 changes: 32 additions & 0 deletions guides/bug_report_templates/action_view_main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
source "https://rubygems.org"

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "rails", github: "rails/rails", branch: "main"
end

require "minitest/autorun"
require "action_view"

class BuggyViewTest < ActionView::TestCase
module Helpers
def upcase(value)
value.upcase
end
end

def test_stuff
view.extend Helpers

render inline: <<~ERB, locals: { key: "value" }
<p><%= upcase(key) %></p>
ERB

assert_includes rendered.html.at("p").text, "VALUE"
end
end
1 change: 1 addition & 0 deletions guides/source/contributing_to_ruby_on_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Having a way to reproduce your issue will help people confirm, investigate, and
* Template for Active Record (models, database) issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record_main.rb)
* Template for testing Active Record (migration) issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record_migrations_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record_migrations_main.rb)
* Template for Action Pack (controllers, routing) issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_controller_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_controller_main.rb)
* Template for Action View (views, helpers) issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_view_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_view_main.rb)
* Template for Active Job issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_job_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_job_main.rb)
* Template for Active Storage issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_storage_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_storage_main.rb)
* Template for Action Mailbox issues: [gem](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_mailbox_gem.rb) / [main](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_mailbox_main.rb)
Expand Down

0 comments on commit d8ea067

Please sign in to comment.