wicked_pdf 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,25 +2,27 @@ require 'test_helper'
2
2
  require 'action_view/test_case'
3
3
 
4
4
  class WickedPdfHelperTest < ActionView::TestCase
5
- if Rails::VERSION::MAJOR == 2
6
- test 'wicked_pdf_stylesheet_link_tag should inline the stylesheets passed in' do
7
- assert_equal "<style type='text/css'>/* Wicked styles */\n</style>",
8
- wicked_pdf_stylesheet_link_tag('../../../fixtures/wicked')
9
- end
5
+ include WickedPdf::WickedPdfHelper
10
6
 
11
- test 'wicked_pdf_image_tag should return the same as image_tag when passed a full path' do
12
- assert_equal image_tag("file:///#{Rails.root.join('public', 'images', 'pdf')}"),
13
- wicked_pdf_image_tag('pdf')
14
- end
7
+ test 'wicked_pdf_stylesheet_link_tag should inline the stylesheets passed in' do
8
+ assert_equal "<style type='text/css'>/* Wicked styles */\n</style>",
9
+ wicked_pdf_stylesheet_link_tag('../../../fixtures/wicked')
10
+ end
15
11
 
12
+ test 'wicked_pdf_image_tag should return the same as image_tag when passed a full path' do
13
+ assert_equal image_tag("file:///#{Rails.root.join('public', 'images', 'pdf')}"),
14
+ wicked_pdf_image_tag('pdf')
15
+ end
16
+
17
+ if Rails::VERSION::MAJOR == 2
16
18
  test 'wicked_pdf_javascript_src_tag should return the same as javascript_src_tag when passed a full path' do
17
19
  assert_equal javascript_src_tag("file:///#{Rails.root.join('public', 'javascripts', 'pdf')}", {}),
18
20
  wicked_pdf_javascript_src_tag('pdf')
19
21
  end
22
+ end
20
23
 
21
- test 'wicked_pdf_include_tag should return many wicked_pdf_javascript_src_tags' do
22
- assert_equal [wicked_pdf_javascript_src_tag('foo'), wicked_pdf_javascript_src_tag('bar')].join("\n"),
23
- wicked_pdf_javascript_include_tag('foo', 'bar')
24
- end
24
+ test 'wicked_pdf_include_tag should return many wicked_pdf_javascript_src_tags' do
25
+ assert_equal [wicked_pdf_javascript_src_tag('foo'), wicked_pdf_javascript_src_tag('bar')].join("\n"),
26
+ wicked_pdf_javascript_include_tag('foo', 'bar')
25
27
  end
26
28
  end
@@ -18,7 +18,13 @@ require 'wicked_pdf'
18
18
  Rails.backtrace_cleaner.remove_silencers!
19
19
 
20
20
  if (assets_dir = Rails.root.join('app/assets')) && File.directory?(assets_dir)
21
+ # Copy CSS file
21
22
  destination = assets_dir.join('stylesheets/wicked.css')
22
23
  source = File.read('test/fixtures/wicked.css')
23
24
  File.open(destination, 'w') { |f| f.write(source) }
25
+
26
+ # Copy JS file
27
+ destination = assets_dir.join('javascripts/wicked.js')
28
+ source = File.read('test/fixtures/wicked.js')
29
+ File.open(destination, 'w') { |f| f.write(source) }
24
30
  end
@@ -61,7 +61,7 @@ class WickedPdfTest < ActiveSupport::TestCase
61
61
  begin
62
62
  tmp = Tempfile.new('wkhtmltopdf')
63
63
  fp = tmp.path
64
- File.chmod 0000, fp
64
+ File.chmod 0o000, fp
65
65
  assert_raise RuntimeError do
66
66
  WickedPdf.new fp
67
67
  end
@@ -74,7 +74,7 @@ class WickedPdfTest < ActiveSupport::TestCase
74
74
  begin
75
75
  tmp = Tempfile.new('wkhtmltopdf')
76
76
  fp = tmp.path
77
- File.chmod 0777, fp
77
+ File.chmod 0o777, fp
78
78
  wp = WickedPdf.new fp
79
79
  assert_raise RuntimeError do
80
80
  wp.pdf_from_string HTML_DOCUMENT
@@ -143,7 +143,7 @@ class WickedPdfTest < ActiveSupport::TestCase
143
143
  pathname = Rails.root.join('app', 'views', 'pdf', 'file.html')
144
144
  assert_equal "#{cover_option} http://example.org", @wp.get_parsed_options(:cover => 'http://example.org').strip, 'URL'
145
145
  assert_equal "#{cover_option} #{pathname}", @wp.get_parsed_options(:cover => pathname).strip, 'Pathname'
146
- assert_match %r(#{cover_option} .+wicked_cover_pdf.+\.html), @wp.get_parsed_options(:cover => '<html><body>HELLO</body></html>').strip, 'HTML'
146
+ assert_match %r{#{cover_option} .+wicked_cover_pdf.+\.html}, @wp.get_parsed_options(:cover => '<html><body>HELLO</body></html>').strip, 'HTML'
147
147
  end
148
148
 
149
149
  test 'should parse other options' do
@@ -2,6 +2,7 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'wicked_pdf/version'
5
+ require 'English'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = 'wicked_pdf'
@@ -18,7 +19,7 @@ In other words, rather than dealing with a PDF generation DSL of some sort,
18
19
  you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
19
20
  desc
20
21
 
21
- spec.files = `git ls-files`.split($/)
22
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
22
23
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
24
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
25
  spec.require_paths = ['lib']
@@ -26,7 +27,7 @@ desc
26
27
  spec.add_development_dependency 'rails'
27
28
  spec.add_development_dependency 'bundler', '~> 1.3'
28
29
  spec.add_development_dependency 'rake'
29
- spec.add_development_dependency 'rubocop' if RUBY_VERSION > '1.9.2'
30
+ spec.add_development_dependency 'rubocop' if RUBY_VERSION >= '2.0.0'
30
31
  spec.add_development_dependency 'sqlite3'
31
32
  spec.add_development_dependency 'mocha'
32
33
  spec.add_development_dependency 'test-unit'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wicked_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Z. Sterrett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -133,6 +133,7 @@ files:
133
133
  - gemfiles/4.0.gemfile
134
134
  - gemfiles/4.1.gemfile
135
135
  - gemfiles/4.2.gemfile
136
+ - gemfiles/5.0.gemfile
136
137
  - gemfiles/rails_edge.gemfile
137
138
  - generators/wicked_pdf/templates/wicked_pdf.rb
138
139
  - generators/wicked_pdf/wicked_pdf_generator.rb
@@ -148,6 +149,7 @@ files:
148
149
  - lib/wicked_pdf/wicked_pdf_helper/assets.rb
149
150
  - test/fixtures/document_with_long_line.html
150
151
  - test/fixtures/wicked.css
152
+ - test/fixtures/wicked.js
151
153
  - test/functional/pdf_helper_test.rb
152
154
  - test/functional/wicked_pdf_helper_assets_test.rb
153
155
  - test/functional/wicked_pdf_helper_test.rb
@@ -174,16 +176,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  version: '0'
175
177
  requirements: []
176
178
  rubyforge_project:
177
- rubygems_version: 2.4.5
179
+ rubygems_version: 2.5.1
178
180
  signing_key:
179
181
  specification_version: 4
180
182
  summary: PDF generator (from HTML) gem for Ruby on Rails
181
183
  test_files:
182
184
  - test/fixtures/document_with_long_line.html
183
185
  - test/fixtures/wicked.css
186
+ - test/fixtures/wicked.js
184
187
  - test/functional/pdf_helper_test.rb
185
188
  - test/functional/wicked_pdf_helper_assets_test.rb
186
189
  - test/functional/wicked_pdf_helper_test.rb
187
190
  - test/test_helper.rb
188
191
  - test/unit/wicked_pdf_test.rb
189
- has_rdoc: