diff --git a/test/fixtures/placeholders.html.erb b/test/fixtures/files/placeholders.html.erb similarity index 100% rename from test/fixtures/placeholders.html.erb rename to test/fixtures/files/placeholders.html.erb diff --git a/test/fixtures/placeholders.html.haml b/test/fixtures/files/placeholders.html.haml similarity index 100% rename from test/fixtures/placeholders.html.haml rename to test/fixtures/files/placeholders.html.haml diff --git a/test/fixtures/placeholders.html.slim b/test/fixtures/files/placeholders.html.slim similarity index 100% rename from test/fixtures/placeholders.html.slim rename to test/fixtures/files/placeholders.html.slim diff --git a/test/fixtures/show.html.erb b/test/fixtures/files/show.html.erb similarity index 100% rename from test/fixtures/show.html.erb rename to test/fixtures/files/show.html.erb diff --git a/test/fixtures/show.html.haml b/test/fixtures/files/show.html.haml similarity index 100% rename from test/fixtures/show.html.haml rename to test/fixtures/files/show.html.haml diff --git a/test/fixtures/show.html.slim b/test/fixtures/files/show.html.slim similarity index 100% rename from test/fixtures/show.html.slim rename to test/fixtures/files/show.html.slim diff --git a/test/fixtures/simple.html.erb b/test/fixtures/files/simple.html.erb similarity index 100% rename from test/fixtures/simple.html.erb rename to test/fixtures/files/simple.html.erb diff --git a/test/fixtures/simple.html.haml b/test/fixtures/files/simple.html.haml similarity index 100% rename from test/fixtures/simple.html.haml rename to test/fixtures/files/simple.html.haml diff --git a/test/fixtures/simple.html.slim b/test/fixtures/files/simple.html.slim similarity index 100% rename from test/fixtures/simple.html.slim rename to test/fixtures/files/simple.html.slim diff --git a/test/purger_test.rb b/test/purger_test.rb index c23dc68d..edc75341 100644 --- a/test/purger_test.rb +++ b/test/purger_test.rb @@ -8,7 +8,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase test "extract class names from erb file" do assert_equal %w[ div class max-w-7xl mx-auto my-1.5 px-4 sm:px-6 lg:px-8 sm:py-0.5 translate-x-1/2 ].sort, - Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.erb")) + Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.erb")) end test "extract class names from haml string" do @@ -18,7 +18,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase test "extract class names from haml file" do assert_equal %w[ class max-w-7xl mx-auto my-1.5 px-4 sm:px-6 lg:px-8 sm:py-0.5 translate-x-1/2 ].sort, - Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.haml")) + Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.haml")) end test "extract class names from slim string" do @@ -28,7 +28,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase test "extract class names from slim file" do assert_equal %w[ class max-w-7xl mx-auto my-1.5 px-4 sm:px-6 lg:px-8 sm:py-0.5 translate-x-1/2 ].sort, - Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.slim")) + Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.slim")) end test "basic purge" do @@ -104,7 +104,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase end test "purge shouldn't remove placeholder selectors" do - purged = purged_tailwind_from Pathname(__dir__).join("fixtures/placeholders.html.erb") + purged = purged_tailwind_from file_fixture("placeholders.html.erb") assert purged =~ /.placeholder-transparent\:\:-moz-placeholder \{/ assert purged =~ /.placeholder-transparent\:-ms-input-placeholder \{/ @@ -189,15 +189,15 @@ def purged_tailwind(keep_these_class_names:) end def purged_tailwind_from_erb_fixtures - $purged_tailwind_from_erb_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.erb") + $purged_tailwind_from_erb_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.erb") end def purged_tailwind_from_haml_fixtures - $purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.haml") + $purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.haml") end def purged_tailwind_from_slim_fixtures - $purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.slim") + $purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.slim") end def purged_tailwind_from files diff --git a/test/test_helper.rb b/test/test_helper.rb index d7a01c0d..ae9d1581 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,3 +9,6 @@ require "rails/test_unit/reporter" Rails::TestUnitReporter.executable = 'bin/test' +class ActiveSupport::TestCase + self.file_fixture_path = File.expand_path("fixtures/files", __dir__) +end