Skip to content

Commit

Permalink
resolve warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhawksley committed Jan 7, 2025
1 parent 0d7d662 commit 4c9cf7e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
44 changes: 24 additions & 20 deletions test/sandbox/test/rendering_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -964,11 +964,13 @@ def test_multithread_render
end

def test_concurrency_deadlock_cache
with_compiler_development_mode(true) do
with_new_cache do
render_inline(ContentEvalComponent.new) do
ViewComponent::CompileCache.invalidate!
render_inline(ContentEvalComponent.new)
assert_nothing_raised do
with_compiler_development_mode(true) do
with_new_cache do
render_inline(ContentEvalComponent.new) do
ViewComponent::CompileCache.invalidate!
render_inline(ContentEvalComponent.new)
end
end
end
end
Expand Down Expand Up @@ -1089,27 +1091,29 @@ def test_renders_nested_collection
end

def test_concurrency_deadlock
with_compiler_development_mode(true) do
with_new_cache do
mutex = Mutex.new
assert_nothing_raised do
with_compiler_development_mode(true) do
with_new_cache do
mutex = Mutex.new

t1 = Thread.new do
mutex.synchronize do
sleep 0.02
render_inline(ContentEvalComponent.new)
t1 = Thread.new do
mutex.synchronize do
sleep 0.02
render_inline(ContentEvalComponent.new)
end
end
end

t = Thread.new do
render_inline(ContentEvalComponent.new) do
mutex.synchronize do
sleep 0.01
t = Thread.new do
render_inline(ContentEvalComponent.new) do
mutex.synchronize do
sleep 0.01
end
end
end
end

t1.join
t.join
t1.join
t.join
end
end
end
end
Expand Down
6 changes: 4 additions & 2 deletions test/sandbox/test/slotable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,10 @@ def test_slot_with_block_content
end

def test_lambda_slot_with_missing_block
render_inline(SlotsComponent.new(classes: "mt-4")) do |component|
component.with_footer(classes: "text-blue")
assert_nothing_raised do
render_inline(SlotsComponent.new(classes: "mt-4")) do |component|
component.with_footer(classes: "text-blue")
end
end
end

Expand Down
16 changes: 9 additions & 7 deletions test/sandbox/test/view_component_system_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ def test_component_with_params
end

def test_components_with_slots
with_rendered_component_path(render_inline(SlotsComponent.new) do |component|
component.with_title do
"This is my title!"
assert_nothing_raised do
with_rendered_component_path(render_inline(SlotsComponent.new) do |component|
component.with_title do
"This is my title!"
end
end) do |path|
visit path

find(".title", text: "This is my title!")
end
end) do |path|
visit path

find(".title", text: "This is my title!")
end
end

Expand Down

0 comments on commit 4c9cf7e

Please sign in to comment.