mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Move dependency tracker tests shared examples
The bulk of these tests should be run using both the ERBTracker and the RipperTracker until ERBTracker is eventually removed.
This commit is contained in:
parent
caac7313c5
commit
73b3772e49
1 changed files with 19 additions and 6 deletions
|
@ -55,11 +55,8 @@ class DependencyTrackerTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class RipperTrackerTest < Minitest::Test
|
# Tests run with both ERBTracker and RipperTracker
|
||||||
def make_tracker(name, template)
|
module SharedTrackerTests
|
||||||
ActionView::DependencyTracker::RipperTracker.new(name, template)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_dependency_of_erb_template_with_number_in_filename
|
def test_dependency_of_erb_template_with_number_in_filename
|
||||||
template = FakeTemplate.new("<%= render 'messages/message123' %>", :erb)
|
template = FakeTemplate.new("<%= render 'messages/message123' %>", :erb)
|
||||||
tracker = make_tracker("messages/_message123", template)
|
tracker = make_tracker("messages/_message123", template)
|
||||||
|
@ -71,7 +68,7 @@ class RipperTrackerTest < Minitest::Test
|
||||||
template = FakeTemplate.new("<%= render partial: 'messages/show', layout: 'messages/layout' %>", :erb)
|
template = FakeTemplate.new("<%= render partial: 'messages/show', layout: 'messages/layout' %>", :erb)
|
||||||
tracker = make_tracker("multiple/_dependencies", template)
|
tracker = make_tracker("multiple/_dependencies", template)
|
||||||
|
|
||||||
assert_equal ["messages/show", "messages/layout"], tracker.dependencies
|
assert_equal ["messages/layout", "messages/show"], tracker.dependencies.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dependency_of_template_layout_standalone
|
def test_dependency_of_template_layout_standalone
|
||||||
|
@ -209,6 +206,22 @@ class RipperTrackerTest < Minitest::Test
|
||||||
|
|
||||||
assert_equal ["single/\#{quote}"], tracker.dependencies
|
assert_equal ["single/\#{quote}"], tracker.dependencies
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class ERBTrackerTest < Minitest::Test
|
||||||
|
include SharedTrackerTests
|
||||||
|
|
||||||
|
def make_tracker(name, template)
|
||||||
|
ActionView::DependencyTracker::ERBTracker.new(name, template)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class RipperTrackerTest < Minitest::Test
|
||||||
|
include SharedTrackerTests
|
||||||
|
|
||||||
|
def make_tracker(name, template)
|
||||||
|
ActionView::DependencyTracker::RipperTracker.new(name, template)
|
||||||
|
end
|
||||||
|
|
||||||
def test_dependencies_skip_unknown_options
|
def test_dependencies_skip_unknown_options
|
||||||
template = FakeTemplate.new(%{
|
template = FakeTemplate.new(%{
|
||||||
|
|
Loading…
Reference in a new issue