Skip to content

Commit 2ded1df

Browse files
committed
Test precompilation #14
1 parent cde73a8 commit 2ded1df

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
@import 'bootstrap'
2+
3+
.test-mixin
4+
+make-container

test/dummy_rails/config/application.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
module Dummy
2323
class Application < Rails::Application
2424
config.assets.enabled = true if config.assets.respond_to?(:enabled)
25-
config.assets.precompile += %w( application.css application.js )
2625
config.to_prepare do
2726
if ENV['VERBOSE']
2827
STDERR.puts "Loaded Rails #{Rails::VERSION::STRING}, Sprockets #{Sprockets::VERSION}",

test/rails_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ def test_autoprefixer
1616
get ActionController::Base.helpers.stylesheet_path('application.css')
1717
assert_match /-webkit-(?:transition|transform)/, response.body
1818
end
19+
20+
def test_precompile
21+
Dummy::Application.load_tasks
22+
Rake::Task['assets:precompile'].invoke
23+
end
1924
end

test/support/dummy_rails_integration.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ module DummyRailsIntegration
55

66
def setup
77
super
8-
FileUtils.rm_rf('test/dummy_rails/tmp/cache', secure: true)
8+
cleanup_dummy_rails_files
99
end
1010

1111
def teardown
1212
super
13+
cleanup_dummy_rails_files
1314
Capybara.reset_sessions!
1415
Capybara.use_default_driver
1516
end
@@ -19,4 +20,10 @@ def screenshot!
1920
page.driver.render(File.join(GEM_PATH, path), full: true)
2021
STDERR.puts "Screenshot saved to #{path}"
2122
end
23+
24+
private
25+
def cleanup_dummy_rails_files
26+
FileUtils.rm_rf('test/dummy_rails/tmp/cache', secure: true)
27+
FileUtils.rm Dir.glob('test/dummy_rails/public/assets/*')
28+
end
2229
end

0 commit comments

Comments
 (0)