Skip to content

Commit fe2632f

Browse files
committed
Add actionview bug report template
Introduce Action View bug report template 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.
1 parent 860ab28 commit fe2632f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
require "bundler/inline"
4+
5+
gemfile(true) do
6+
source "https://rubygems.org"
7+
8+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
9+
10+
gem "rails"
11+
# If you want to test against edge Rails replace the previous line with this:
12+
# gem "rails", github: "rails/rails", branch: "main"
13+
end
14+
15+
require "minitest/autorun"
16+
require "action_view"
17+
18+
class BugTest < ActionView::TestCase
19+
helper do
20+
def upcase(value)
21+
value.upcase
22+
end
23+
end
24+
25+
def test_stuff
26+
render inline: <<~ERB, locals: { key: "value" }
27+
<p><%= upcase(key) %></p>
28+
ERB
29+
30+
element = rendered.html.at("p")
31+
32+
assert_equal element.text, "VALUE"
33+
end
34+
end

guides/source/contributing_to_ruby_on_rails.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Having a way to reproduce your issue will help people confirm, investigate, and
4242
* Template for Active Record (models, database) issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record.rb)
4343
* Template for testing Active Record (migration) issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_record_migrations.rb)
4444
* Template for Action Pack (controllers, routing) issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_controller.rb)
45+
* Template for Action View (views, helpers) issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_view.rb)
4546
* Template for Active Job issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_job.rb)
4647
* Template for Active Storage issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/active_storage.rb)
4748
* Template for Action Mailer issues: [link](https://github.com/rails/rails/blob/main/guides/bug_report_templates/action_mailer.rb)

0 commit comments

Comments
 (0)