Skip to content

Commit cc51319

Browse files
authored
Merge pull request #2355 from ViewComponent/v4-warnings
Resolve remaining warnings when running tests
2 parents 85d15a4 + 682d68f commit cc51319

File tree

9 files changed

+13
-20
lines changed

9 files changed

+13
-20
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
bundler-cache: true
4949
- name: Build and test with Rake
5050
run: |
51-
bundle exec appraisal rails-${{ matrix.rails_version }} bundle
51+
bundle exec appraisal rails-${{ matrix.rails_version }} bundle --quiet
5252
MEASURE_COVERAGE=true bundle exec appraisal rails-${{ matrix.rails_version }} rake
5353
env:
5454
RAISE_ON_WARNING: 1
@@ -89,7 +89,7 @@ jobs:
8989
cd primer_view_components
9090
npm ci
9191
cd demo && npm ci && cd ..
92-
bundle && bundle exec rake
92+
bundle --quiet && bundle exec rake
9393
env:
9494
VIEW_COMPONENT_PATH: ../view_component
9595
RAILS_VERSION: '7.1.5'

Rakefile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ Rake::TestTask.new(:engine_test) do |t|
1717
t.test_files = FileList["test/test_engine/**/*_test.rb"]
1818
end
1919

20-
Rake::TestTask.new(:docs_test) do |t|
21-
t.libs << "test"
22-
t.libs << "lib"
23-
t.test_files = FileList["test/docs/*_test.rb"]
24-
end
25-
2620
begin
2721
require "rspec/core/rake_task"
2822
RSpec::Core::RakeTask.new(:spec)
@@ -60,18 +54,13 @@ namespace :coverage do
6054
end
6155

6256
namespace :docs do
63-
# Build api.md documentation page from YARD comments.
6457
task :build do
6558
YARD::Rake::YardocTask.new do |t|
66-
t.options = ["--no-output"]
59+
t.options = ["--no-output", "-q"]
6760
end
6861

69-
puts "Building YARD documentation."
70-
7162
Rake::Task["yard"].execute
7263

73-
puts "Converting YARD documentation to Markdown files."
74-
7564
registry = YARD::RegistryStore.new
7665
registry.load!(".yardoc")
7766

@@ -141,4 +130,4 @@ namespace :docs do
141130
end
142131
end
143132

144-
task default: [:docs_test, :test, :engine_test, :spec]
133+
task default: [:test, :engine_test, :spec]

test/sandbox/app/components/conditional_content_with_arg_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def initialize(description: nil)
66
end
77

88
def call
9-
description
9+
description&.html_safe
1010
end
1111

1212
private

test/sandbox/app/components/request_param_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ def initialize(request:)
44
end
55

66
def call
7-
@request
7+
@request.html_safe
88
end
99
end

test/sandbox/config/application.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
module Sandbox
3939
class Application < Rails::Application
40+
config.load_defaults(8.1) if Rails::VERSION::MAJOR == 8 && Rails::VERSION::MINOR == 1
41+
4042
config.action_controller.asset_host = "http://assets.example.com"
4143

4244
# Prepare test_set_no_duplicate_autoload_paths

test/sandbox/config/environments/test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
# Use https://github.com/jeremyevans/ruby-warning
66
# to restrict warnings outside our control
7-
["mail", "activesupport", "yard"].each do |gem_name|
7+
["mail", "activesupport", "yard", "capybara"].each do |gem_name|
88
Warning.ignore(//, /.*gems\/#{gem_name}-.*/)
99
end
1010

11+
Warning.ignore(/warning: parser\/current/)
12+
1113
Sandbox::Application.configure do
1214
# Settings specified here will take precedence over those in config/application.rb
1315

test/sandbox/test/config_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_all_methods_are_documented
2020
require "yard"
2121
require "rake"
2222
YARD::Rake::YardocTask.new do |t|
23-
t.options = ["--no-output", "--no-stats", "--no-progress"]
23+
t.options = ["--no-output", "--no-stats", "--no-progress", "-q"]
2424
end
2525
Rake::Task["yard"].execute
2626
configuration_methods_to_document = YARD::RegistryStore.new.tap do |store|

test/sandbox/test/rendering_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ def call
12531253
#
12541254
# hi # raises: undefined method `hi' for #<GreetingComponent....
12551255
#
1256-
helpers.hi
1256+
helpers.hi.html_safe
12571257
end
12581258
end
12591259

File renamed without changes.

0 commit comments

Comments
 (0)