Skip to content

Commit 47881fe

Browse files
authored
Use file_fixture for file fixtures (#75)
1 parent 8f3484a commit 47881fe

File tree

11 files changed

+10
-7
lines changed

11 files changed

+10
-7
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/purger_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
88

99
test "extract class names from erb file" do
1010
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,
11-
Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.erb"))
11+
Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.erb"))
1212
end
1313

1414
test "extract class names from haml string" do
@@ -18,7 +18,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
1818

1919
test "extract class names from haml file" do
2020
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,
21-
Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.haml"))
21+
Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.haml"))
2222
end
2323

2424
test "extract class names from slim string" do
@@ -28,7 +28,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
2828

2929
test "extract class names from slim file" do
3030
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,
31-
Tailwindcss::Purger.extract_class_names_from(Pathname.new(__dir__).join("fixtures/simple.html.slim"))
31+
Tailwindcss::Purger.extract_class_names_from(file_fixture("simple.html.slim"))
3232
end
3333

3434
test "basic purge" do
@@ -104,7 +104,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
104104
end
105105

106106
test "purge shouldn't remove placeholder selectors" do
107-
purged = purged_tailwind_from Pathname(__dir__).join("fixtures/placeholders.html.erb")
107+
purged = purged_tailwind_from file_fixture("placeholders.html.erb")
108108

109109
assert purged =~ /.placeholder-transparent\:\:-moz-placeholder \{/
110110
assert purged =~ /.placeholder-transparent\:-ms-input-placeholder \{/
@@ -189,15 +189,15 @@ def purged_tailwind(keep_these_class_names:)
189189
end
190190

191191
def purged_tailwind_from_erb_fixtures
192-
$purged_tailwind_from_erb_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.erb")
192+
$purged_tailwind_from_erb_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.erb")
193193
end
194194

195195
def purged_tailwind_from_haml_fixtures
196-
$purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.haml")
196+
$purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.haml")
197197
end
198198

199199
def purged_tailwind_from_slim_fixtures
200-
$purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/*.html.slim")
200+
$purged_tailwind_from_haml_fixtures ||= purged_tailwind_from Pathname(__dir__).glob("fixtures/files/*.html.slim")
201201
end
202202

203203
def purged_tailwind_from files

0 commit comments

Comments
 (0)