Skip to content

Commit 460150f

Browse files
committed
Fix No such file or directory tmp/cache issue in tests
1 parent 4752e67 commit 460150f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

test/generators/scaffold_controller_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# require 'active_model/serializer/railtie'
33

44
class ResourceGeneratorTest < Rails::Generators::TestCase
5-
destination File.expand_path('../../tmp', __FILE__)
5+
destination File.expand_path('../../../tmp/generators', __FILE__)
66
setup :prepare_destination, :copy_routes
77

88
tests Rails::Generators::ResourceGenerator

test/generators/serializer_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'generators/serializer/serializer_generator'
33

44
class SerializerGeneratorTest < Rails::Generators::TestCase
5-
destination File.expand_path("../../tmp", __FILE__)
5+
destination File.expand_path("../../../tmp/generators", __FILE__)
66
setup :prepare_destination
77

88
tests Rails::Generators::SerializerGenerator

test/test_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'action_controller/railtie'
77
require 'active_support/json'
88
require 'minitest/autorun'
9+
require 'fileutils'
910
# Ensure backward compatibility with Minitest 4
1011
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
1112

@@ -21,7 +22,7 @@ class Foo < Rails::Application
2122
ActionController::Base.cache_store = :memory_store
2223
end
2324
end
24-
ActionController::Base.cache_store.clear
25+
FileUtils.mkdir_p(File.expand_path('../../tmp/cache', __FILE__))
2526
Foo.initialize!
2627

2728
require 'fixtures/poro'

0 commit comments

Comments
 (0)