Skip to content

Commit

Permalink
Fix failing (from time to time) test
Browse files Browse the repository at this point in the history
Test was failing probably due to assets caching. Copy "wicked.css" to dummy app
on tests initialization instead of test runtime. This fixes problem.
  • Loading branch information
Piotr Boniecki committed Jan 8, 2016
1 parent 4323abe commit 2ec3559
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions test/functional/wicked_pdf_helper_assets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ class WickedPdfHelperAssetsTest < ActionView::TestCase

if Rails::VERSION::MAJOR > 3 || (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR > 0)
test 'wicked_pdf_asset_base64 returns a base64 encoded asset' do
source = File.new('test/fixtures/wicked.css', 'r')
destination = Rails.root.join('app', 'assets', 'stylesheets', 'wicked.css')
File.open(destination, 'w') { |f| f.write(source) }
assert_match /data:text\/css;base64,.+/, wicked_pdf_asset_base64('wicked.css')
end

Expand Down
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
require 'wicked_pdf'

Rails.backtrace_cleaner.remove_silencers!

if (assets_dir = Rails.root.join('app/assets')) && File.directory?(assets_dir)
destination = assets_dir.join('stylesheets/wicked.css')
source = File.read('test/fixtures/wicked.css')
File.open(destination, 'w') { |f| f.write(source) }
end

0 comments on commit 2ec3559

Please sign in to comment.