From 394b5f25d88bb172db1a154d9d596ff2d9ed7dd9 Mon Sep 17 00:00:00 2001 From: Sam R Date: Fri, 22 Feb 2019 12:02:27 +0000 Subject: [PATCH 1/5] Updates to Dockerfile. Added libfontconfig libxext6 in order to fix errors: /usr/local/bundle/gems/nokogiri-1.6.8.1/lib/nokogiri/html/document.rb:164: warning: constant ::Fixnum is deprecated /usr/local/bundle/gems/wkhtmltopdf-binary-0.9.9.3/bin/wkhtmltopdf_linux_x64: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5e4f1e7..94693d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN buildDependencies=' \ build-essential \ ' \ && apt-get update \ - && apt-get install -y --no-install-recommends --no-install-suggests ${buildDependencies} \ + && apt-get install -y --no-install-recommends --no-install-suggests ${buildDependencies} libfontconfig libxext6 \ && gem install gimli \ && apt-get purge -y --auto-remove ${buildDependencies} \ && rm -rf /var/lib/apt/lists/* From 896ae56f24e0b19e7a6fd14eac3a29fbc4e4331b Mon Sep 17 00:00:00 2001 From: Sam R Date: Fri, 22 Feb 2019 12:27:50 +0000 Subject: [PATCH 2/5] Update to change mock to double based on: https://github.com/rspec/rspec-mocks/pull/233/files https://stackoverflow.com/questions/33182271/nomethoderror-undefined-method-mock-for-rspecexamplegroupscompetitionsc --- spec/gimli/converter_spec.rb | 13 ++++++------- spec/gimli/path_spec.rb | 4 ++-- spec/gimli/wkhtmltopdf_spec.rb | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/spec/gimli/converter_spec.rb b/spec/gimli/converter_spec.rb index 4869a85..63bed4e 100644 --- a/spec/gimli/converter_spec.rb +++ b/spec/gimli/converter_spec.rb @@ -8,10 +8,10 @@ it 'should give the correct output_file with none given' do file = Gimli::MarkupFile.new 'fake' name = 'my_file' - mock(file).name { name } + double(file).name { name } converter = Gimli::Converter.new [file], Gimli::Config.new - mock(converter).output_dir { Dir.getwd } + double(converter).output_dir { Dir.getwd } converter.output_file.should == File.join(Dir.getwd, "#{name}.pdf") end @@ -19,10 +19,10 @@ it 'should give the correct output_file with one given' do file = Gimli::MarkupFile.new 'fake' name = 'my_file' - mock(file).name { name } + double(file).name { name } converter = Gimli::Converter.new [file], Gimli::Config.new - mock(converter).output_dir { '/tmp/out' } + double(converter).output_dir { '/tmp/out' } converter.output_file(file).should == "/tmp/out/#{name}.pdf" end @@ -36,7 +36,7 @@ end converter = Gimli::Converter.new [file], config - mock(converter).output_dir { Dir.getwd } + double(converter).output_dir { Dir.getwd } converter.output_file(file).should == File.join(Dir.getwd, "#{output_filename}.pdf") end @@ -61,7 +61,7 @@ converter = Gimli::Converter.new file, config - mock(File).directory?(dir) { true } + double(File).directory?(dir) { true } converter.output_dir.should == dir end @@ -136,4 +136,3 @@ File.exists?(coverfile.path).should == true end end - diff --git a/spec/gimli/path_spec.rb b/spec/gimli/path_spec.rb index ebcb930..d5f5ab4 100644 --- a/spec/gimli/path_spec.rb +++ b/spec/gimli/path_spec.rb @@ -7,12 +7,12 @@ describe Gimli::Path do it 'should find all files in the current directory, with no specified target, without recursion' do - mock(Dir).pwd { './spec/fixtures/recursion/' } + double(Dir).pwd { './spec/fixtures/recursion/' } Gimli::Path.list_valid(nil, false).length.should == 1 end it 'should find all files in all subdirectories, with no specified target, with recursion ' do - mock(Dir).pwd { './spec/fixtures/recursion/' } + double(Dir).pwd { './spec/fixtures/recursion/' } Gimli::Path.list_valid(nil, true).length.should == 2 end diff --git a/spec/gimli/wkhtmltopdf_spec.rb b/spec/gimli/wkhtmltopdf_spec.rb index 80d5c2d..7f7cefd 100644 --- a/spec/gimli/wkhtmltopdf_spec.rb +++ b/spec/gimli/wkhtmltopdf_spec.rb @@ -11,7 +11,7 @@ end it 'should assemble correct command' do - mock(@wkhtmltopdf).bin { '"wkhtmltopdf"' } + double(@wkhtmltopdf).bin { '"wkhtmltopdf"' } args = @wkhtmltopdf.command('test.pdf') args.size.should eq 4 args.should include '"wkhtmltopdf"' @@ -21,14 +21,14 @@ end it 'should use which to find wkhtmltopdf first time' do - mock(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } + double(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } @wkhtmltopdf.bin.should eq '"~/wkhtmltopdf"' @wkhtmltopdf.bin.should eq '"~/wkhtmltopdf"' # Should be cached end it 'should generate a pdf' do - mock(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } - mock(IO).popen("\"~/wkhtmltopdf\" -q - \"\"", "wb+") { true } + double(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } + double(IO).popen("\"~/wkhtmltopdf\" -q - \"\"", "wb+") { true } @wkhtmltopdf.output_pdf('', '') end end From d8c3fbb8ff33f0712bdcfadb20a68055ca0a64f8 Mon Sep 17 00:00:00 2001 From: Sam R Date: Fri, 22 Feb 2019 14:20:25 +0000 Subject: [PATCH 3/5] Updates to travis.yml file ruby versions --- .travis.yml | 6 +++--- spec/gimli/converter_spec.rb | 12 ++++++------ spec/gimli/path_spec.rb | 4 ++-- spec/gimli/wkhtmltopdf_spec.rb | 9 ++++----- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index df0a06e..6986dec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ script: "rake" rvm: - - 1.9.3 - - 2.0.0 - - 2.1.3 + - 2.2 + - 2.3 + - 2.4 gemfile: gemfiles/Gemfile.ci diff --git a/spec/gimli/converter_spec.rb b/spec/gimli/converter_spec.rb index 63bed4e..5919de3 100644 --- a/spec/gimli/converter_spec.rb +++ b/spec/gimli/converter_spec.rb @@ -8,10 +8,10 @@ it 'should give the correct output_file with none given' do file = Gimli::MarkupFile.new 'fake' name = 'my_file' - double(file).name { name } + mock(file).name { name } converter = Gimli::Converter.new [file], Gimli::Config.new - double(converter).output_dir { Dir.getwd } + mock(converter).output_dir { Dir.getwd } converter.output_file.should == File.join(Dir.getwd, "#{name}.pdf") end @@ -19,10 +19,10 @@ it 'should give the correct output_file with one given' do file = Gimli::MarkupFile.new 'fake' name = 'my_file' - double(file).name { name } + mock(file).name { name } converter = Gimli::Converter.new [file], Gimli::Config.new - double(converter).output_dir { '/tmp/out' } + mock(converter).output_dir { '/tmp/out' } converter.output_file(file).should == "/tmp/out/#{name}.pdf" end @@ -36,7 +36,7 @@ end converter = Gimli::Converter.new [file], config - double(converter).output_dir { Dir.getwd } + mock(converter).output_dir { Dir.getwd } converter.output_file(file).should == File.join(Dir.getwd, "#{output_filename}.pdf") end @@ -61,7 +61,7 @@ converter = Gimli::Converter.new file, config - double(File).directory?(dir) { true } + mock(File).directory?(dir) { true } converter.output_dir.should == dir end diff --git a/spec/gimli/path_spec.rb b/spec/gimli/path_spec.rb index d5f5ab4..ebcb930 100644 --- a/spec/gimli/path_spec.rb +++ b/spec/gimli/path_spec.rb @@ -7,12 +7,12 @@ describe Gimli::Path do it 'should find all files in the current directory, with no specified target, without recursion' do - double(Dir).pwd { './spec/fixtures/recursion/' } + mock(Dir).pwd { './spec/fixtures/recursion/' } Gimli::Path.list_valid(nil, false).length.should == 1 end it 'should find all files in all subdirectories, with no specified target, with recursion ' do - double(Dir).pwd { './spec/fixtures/recursion/' } + mock(Dir).pwd { './spec/fixtures/recursion/' } Gimli::Path.list_valid(nil, true).length.should == 2 end diff --git a/spec/gimli/wkhtmltopdf_spec.rb b/spec/gimli/wkhtmltopdf_spec.rb index 7f7cefd..6b7716d 100644 --- a/spec/gimli/wkhtmltopdf_spec.rb +++ b/spec/gimli/wkhtmltopdf_spec.rb @@ -11,7 +11,7 @@ end it 'should assemble correct command' do - double(@wkhtmltopdf).bin { '"wkhtmltopdf"' } + mock(@wkhtmltopdf).bin { '"wkhtmltopdf"' } args = @wkhtmltopdf.command('test.pdf') args.size.should eq 4 args.should include '"wkhtmltopdf"' @@ -21,15 +21,14 @@ end it 'should use which to find wkhtmltopdf first time' do - double(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } + mock(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } @wkhtmltopdf.bin.should eq '"~/wkhtmltopdf"' @wkhtmltopdf.bin.should eq '"~/wkhtmltopdf"' # Should be cached end it 'should generate a pdf' do - double(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } - double(IO).popen("\"~/wkhtmltopdf\" -q - \"\"", "wb+") { true } + mock(@wkhtmltopdf).__double_definition_create__.call(:`, "which wkhtmltopdf") { '~/wkhtmltopdf' } + mock(IO).popen("\"~/wkhtmltopdf\" -q - \"\"", "wb+") { true } @wkhtmltopdf.output_pdf('', '') end end - From 6ea7a5367a447878008db6647eeb2e785185554b Mon Sep 17 00:00:00 2001 From: Sam R Date: Fri, 22 Feb 2019 14:32:53 +0000 Subject: [PATCH 4/5] Changes to match a previously passing set of tests --- .travis.yml | 6 +++--- spec/gimli/converter_spec.rb | 1 + spec/gimli/wkhtmltopdf_spec.rb | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6986dec..df0a06e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ script: "rake" rvm: - - 2.2 - - 2.3 - - 2.4 + - 1.9.3 + - 2.0.0 + - 2.1.3 gemfile: gemfiles/Gemfile.ci diff --git a/spec/gimli/converter_spec.rb b/spec/gimli/converter_spec.rb index 5919de3..4869a85 100644 --- a/spec/gimli/converter_spec.rb +++ b/spec/gimli/converter_spec.rb @@ -136,3 +136,4 @@ File.exists?(coverfile.path).should == true end end + diff --git a/spec/gimli/wkhtmltopdf_spec.rb b/spec/gimli/wkhtmltopdf_spec.rb index 6b7716d..80d5c2d 100644 --- a/spec/gimli/wkhtmltopdf_spec.rb +++ b/spec/gimli/wkhtmltopdf_spec.rb @@ -32,3 +32,4 @@ @wkhtmltopdf.output_pdf('', '') end end + From 575505d96f0f7a7e64e8345106f4197ec8b0b645 Mon Sep 17 00:00:00 2001 From: Sam R Date: Fri, 22 Feb 2019 14:36:32 +0000 Subject: [PATCH 5/5] Remove older versions of ruby from travis.yml which don't run under test. Bundler could not find compatible versions for gem "ruby": In Gemfile.ci: ruby bundler was resolved to 1.16.6, which depends on ruby (>= 1.8.7) gimli was resolved to 0.5.9, which depends on nokogiri (~> 1.8.0) was resolved to 1.8.5, which depends on ruby (>= 2.1.0) rake was resolved to 12.3.2, which depends on ruby (>= 2.0.0) --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index df0a06e..9163744 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ script: "rake" rvm: - - 1.9.3 - - 2.0.0 - - 2.1.3 + - 2.1.0 gemfile: gemfiles/Gemfile.ci