pdf_spec 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +38 -0
- data/.gitignore +1 -0
- data/.rspec +4 -1
- data/.ruby-version +1 -1
- data/Gemfile +4 -1
- data/LICENSE +1 -1
- data/README.md +9 -1
- data/lib/pdf_spec/version.rb +1 -1
- data/lib/pdf_spec.rb +1 -1
- data/pdf_spec.gemspec +5 -5
- data/spec/matchers_spec.rb +13 -10
- metadata +32 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4e1297906083b39c22aacbd43c73aeecace582995875ec0089f875ddfc145d06
|
4
|
+
data.tar.gz: 211891eb4afb1f58d9b91e662d010a66e315f8ae29cb3db248fa44cf55152d7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27498a2af00002c0a398fae6e674f28596b78967997c682d4fb26042c595649b3c3739b658f5a1723bcec51518d51aa8ad36bb56a590acd68d80c0ed6f6b369a
|
7
|
+
data.tar.gz: 2e8a43e9855e8cfe4cbbd31c96d0f1145b7ca60f8cb957de90135b61bafdea4d25e0c34446d5e46ef13dbfb594bc3cdcaa66a09dcbcad391bd53cdf10f48697e
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: build
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-20.04
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
rails: ["~> 7.0.0"]
|
19
|
+
rmagick: ["~> 2.3", "~> 3.2", "~> 4.0", "~> 5.0"]
|
20
|
+
ruby: [2.7, '3.0', 3.1, 3.2]
|
21
|
+
|
22
|
+
env:
|
23
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
24
|
+
RMAGICK_VERSION: ${{ matrix.rmagick }}
|
25
|
+
steps:
|
26
|
+
- name: Clone the source
|
27
|
+
uses: actions/checkout@v2
|
28
|
+
- name: Install Ruby, bundler and required gems
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
33
|
+
- name: Install ghostscript
|
34
|
+
run: sudo apt install ghostscript
|
35
|
+
- name: Relax ImageMagick security policy
|
36
|
+
run: sudo sed -i 's/policy\(.*\)"none"\(.*\)PDF/policy\1"read|write"\2PDF/' /etc/ImageMagick-6/policy.xml
|
37
|
+
- name: Execute RSpec test suite
|
38
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0
|
data/Gemfile
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in pdf_spec.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
gem 'rails', (ENV['RAILS_VERSION'] || '~> 7.0')
|
7
|
+
gem 'rmagick', (ENV['RMAGICK_VERSION'] || '~> 3.0')
|
8
|
+
|
6
9
|
group :development, :test do
|
7
10
|
gem 'pry'
|
8
11
|
end
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2013 TMXCredit, authors Zach Belzer, Sergey Potapov
|
3
|
+
Copyright (c) 2013 TMXCredit, authors Zach Belzer, Sergey Potapov, Arthur Shagall
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
@@ -19,10 +19,18 @@ This library depends on the `rmagick` ruby gem.
|
|
19
19
|
|
20
20
|
## Debian (Ubuntu)
|
21
21
|
|
22
|
-
The following was tested on Ubuntu 11.10 and
|
22
|
+
The following was tested on Ubuntu 11.10, 12.04, and 20.04.
|
23
23
|
|
24
24
|
sudo apt-get install libmagickwand-dev
|
25
25
|
|
26
|
+
On Ubuntu 20.04 and later, you may run into the following error:
|
27
|
+
|
28
|
+
Magick::ImageMagickError:
|
29
|
+
attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408
|
30
|
+
|
31
|
+
To resolve this, edit `/etc/ImageMagick-6/policy.xml`. Change `<policy domain="coder" rights="none" pattern="PDF" />` to `<policy domain="coder" rights="read|write" pattern="PDF" />`.
|
32
|
+
If that doesn't help, change `<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->` to `<policy domain="module" rights="read|write" pattern="{PS,PDF,XPS}" />`.
|
33
|
+
|
26
34
|
## (TODO) Gentoo
|
27
35
|
|
28
36
|
# Install libmagickwand
|
data/lib/pdf_spec/version.rb
CHANGED
data/lib/pdf_spec.rb
CHANGED
data/pdf_spec.gemspec
CHANGED
@@ -5,9 +5,9 @@ require "pdf_spec/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "pdf_spec"
|
7
7
|
s.version = PdfSpec::VERSION
|
8
|
-
s.authors = ["TMX Credit", "Zachary Belzer", "Sergey Potapov"]
|
9
|
-
s.email = ["rubygems@tmxcredit.com", "
|
10
|
-
s.homepage = "https://github.com/
|
8
|
+
s.authors = ["TMX Credit", "Zachary Belzer", "Sergey Potapov", "Arthur Shagall"]
|
9
|
+
s.email = ["rubygems@tmxcredit.com", "zbelzer@gmail.com", "blake131313@gmail.com", "arthur.shagall@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/albertosaurus/pdf_spec"
|
11
11
|
s.licenses = ["LICENSE"]
|
12
12
|
s.summary = %q{RSpec matchers for comparing PDF files}
|
13
13
|
s.description = %q{This library includes matchers that use Poppler and Cairo
|
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
23
|
# specify any dependencies here; for example:
|
24
|
-
s.add_development_dependency "rspec"
|
24
|
+
s.add_development_dependency "rspec", '~> 3.1'
|
25
25
|
s.add_development_dependency "rake"
|
26
26
|
|
27
|
-
s.add_runtime_dependency "rmagick", "
|
27
|
+
s.add_runtime_dependency "rmagick", "> 2.3", "< 6"
|
28
28
|
end
|
data/spec/matchers_spec.rb
CHANGED
@@ -4,29 +4,32 @@ module PdfSpec
|
|
4
4
|
module Matchers
|
5
5
|
describe "IdenticalPdfs" do
|
6
6
|
describe "matches?" do
|
7
|
+
let(:fixture_one) { "#{FIXTURES}/one.pdf" }
|
8
|
+
let(:fixture_two) { "#{FIXTURES}/two.pdf" }
|
9
|
+
let(:fixture_three) { "#{FIXTURES}/two_pages.pdf" }
|
10
|
+
|
7
11
|
it "should be true for matching pdfs" do
|
8
|
-
|
9
|
-
|
10
|
-
second_pdf = File.read("#{FIXTURES}/one.pdf")
|
12
|
+
first_pdf = File.read(fixture_one)
|
13
|
+
second_pdf = File.read(fixture_one)
|
11
14
|
|
12
15
|
matcher = IdenticalPdfs.new(first_pdf)
|
13
|
-
matcher.matches?(second_pdf).
|
16
|
+
expect(matcher.matches?(second_pdf)).to eq true
|
14
17
|
end
|
15
18
|
|
16
19
|
it "should be false for differing pdfs" do
|
17
|
-
first_pdf = File.read(
|
18
|
-
second_pdf = File.read(
|
20
|
+
first_pdf = File.read(fixture_one)
|
21
|
+
second_pdf = File.read(fixture_two)
|
19
22
|
|
20
23
|
matcher = IdenticalPdfs.new(first_pdf)
|
21
|
-
matcher.matches?(second_pdf).
|
24
|
+
expect(matcher.matches?(second_pdf)).to eq false
|
22
25
|
end
|
23
26
|
|
24
27
|
it "should be false for pdfs with a different number of pages" do
|
25
|
-
first_pdf = File.read(
|
26
|
-
second_pdf = File.read(
|
28
|
+
first_pdf = File.read(fixture_one)
|
29
|
+
second_pdf = File.read(fixture_three)
|
27
30
|
|
28
31
|
matcher = IdenticalPdfs.new(first_pdf)
|
29
|
-
matcher.matches?(second_pdf).
|
32
|
+
expect(matcher.matches?(second_pdf)).to eq false
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
metadata
CHANGED
@@ -1,73 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TMX Credit
|
8
8
|
- Zachary Belzer
|
9
9
|
- Sergey Potapov
|
10
|
+
- Arthur Shagall
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2023-01-21 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rspec
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - "~>"
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
22
|
+
version: '3.1'
|
22
23
|
type: :development
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
|
-
- -
|
27
|
+
- - "~>"
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
29
|
+
version: '3.1'
|
29
30
|
- !ruby/object:Gem::Dependency
|
30
31
|
name: rake
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
32
33
|
requirements:
|
33
|
-
- -
|
34
|
+
- - ">="
|
34
35
|
- !ruby/object:Gem::Version
|
35
36
|
version: '0'
|
36
37
|
type: :development
|
37
38
|
prerelease: false
|
38
39
|
version_requirements: !ruby/object:Gem::Requirement
|
39
40
|
requirements:
|
40
|
-
- -
|
41
|
+
- - ">="
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '0'
|
43
44
|
- !ruby/object:Gem::Dependency
|
44
45
|
name: rmagick
|
45
46
|
requirement: !ruby/object:Gem::Requirement
|
46
47
|
requirements:
|
47
|
-
- -
|
48
|
+
- - ">"
|
48
49
|
- !ruby/object:Gem::Version
|
49
|
-
version: 2.
|
50
|
+
version: '2.3'
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '6'
|
50
54
|
type: :runtime
|
51
55
|
prerelease: false
|
52
56
|
version_requirements: !ruby/object:Gem::Requirement
|
53
57
|
requirements:
|
54
|
-
- -
|
58
|
+
- - ">"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.3'
|
61
|
+
- - "<"
|
55
62
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
63
|
+
version: '6'
|
57
64
|
description: |-
|
58
65
|
This library includes matchers that use Poppler and Cairo
|
59
66
|
to render PDF files as images and compare them by the pixel
|
60
67
|
email:
|
61
68
|
- rubygems@tmxcredit.com
|
62
|
-
-
|
69
|
+
- zbelzer@gmail.com
|
70
|
+
- blake131313@gmail.com
|
71
|
+
- arthur.shagall@gmail.com
|
63
72
|
executables: []
|
64
73
|
extensions: []
|
65
74
|
extra_rdoc_files: []
|
66
75
|
files:
|
67
|
-
- .
|
68
|
-
- .
|
69
|
-
- .
|
70
|
-
- .ruby-
|
76
|
+
- ".github/workflows/build.yml"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".ruby-gemset"
|
80
|
+
- ".ruby-version"
|
71
81
|
- Gemfile
|
72
82
|
- LICENSE
|
73
83
|
- README.md
|
@@ -86,7 +96,7 @@ files:
|
|
86
96
|
- spec/fixtures/two_pages.pdf
|
87
97
|
- spec/matchers_spec.rb
|
88
98
|
- spec/spec_helper.rb
|
89
|
-
homepage: https://github.com/
|
99
|
+
homepage: https://github.com/albertosaurus/pdf_spec
|
90
100
|
licenses:
|
91
101
|
- LICENSE
|
92
102
|
metadata: {}
|
@@ -96,28 +106,17 @@ require_paths:
|
|
96
106
|
- lib
|
97
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
108
|
requirements:
|
99
|
-
- -
|
109
|
+
- - ">="
|
100
110
|
- !ruby/object:Gem::Version
|
101
111
|
version: '0'
|
102
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
113
|
requirements:
|
104
|
-
- -
|
114
|
+
- - ">="
|
105
115
|
- !ruby/object:Gem::Version
|
106
116
|
version: '0'
|
107
117
|
requirements: []
|
108
|
-
|
109
|
-
rubygems_version: 2.0.7
|
118
|
+
rubygems_version: 3.2.3
|
110
119
|
signing_key:
|
111
120
|
specification_version: 4
|
112
121
|
summary: RSpec matchers for comparing PDF files
|
113
|
-
test_files:
|
114
|
-
- spec/fixtures/one.html
|
115
|
-
- spec/fixtures/one.pdf
|
116
|
-
- spec/fixtures/one_page.html
|
117
|
-
- spec/fixtures/one_page.pdf
|
118
|
-
- spec/fixtures/two.html
|
119
|
-
- spec/fixtures/two.pdf
|
120
|
-
- spec/fixtures/two_pages.html
|
121
|
-
- spec/fixtures/two_pages.pdf
|
122
|
-
- spec/matchers_spec.rb
|
123
|
-
- spec/spec_helper.rb
|
122
|
+
test_files: []
|