From 345685850c476f7ac00f30fa996e1ff51ceeb8b1 Mon Sep 17 00:00:00 2001 From: Mikhail Grachev Date: Sat, 23 Jan 2016 20:56:15 +0300 Subject: [PATCH] Fix travis build --- .travis.yml | 8 +++++++- spec/gastly/screenshot_spec.rb | 3 --- spec/gastly_spec.rb | 4 +--- spec/support/tmp/.keep | 0 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 spec/support/tmp/.keep diff --git a/.travis.yml b/.travis.yml index 6179f0d..c6ce840 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ +dist: trusty language: ruby rvm: - 2.1.7 - 2.2.3 - - 2.3.0 \ No newline at end of file + - 2.3.0 +before_install: + - mkdir travis-phantomjs + - wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 + - tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs + - export PATH=$PWD/travis-phantomjs:$PATH \ No newline at end of file diff --git a/spec/gastly/screenshot_spec.rb b/spec/gastly/screenshot_spec.rb index b5a0296..26e4055 100644 --- a/spec/gastly/screenshot_spec.rb +++ b/spec/gastly/screenshot_spec.rb @@ -40,13 +40,10 @@ expect(Phantomjs).to receive(:run) expect(Phantomjs).to receive(:proxy_host=).with(params[:proxy_host]) expect(Phantomjs).to receive(:proxy_port=).with(params[:proxy_port]) - expect_any_instance_of(Gastly::Image).to receive(:initialize) Gastly::Screenshot.new(url, params).capture end it 'runs js script' do - expect_any_instance_of(Gastly::Image).to receive(:initialize) - screenshot = Gastly::Screenshot.new(url, params) cookies = params[:cookies].map { |key, value| "#{key}=#{value}" }.join(',') args = [ diff --git a/spec/gastly_spec.rb b/spec/gastly_spec.rb index 5988556..dcb3fd7 100644 --- a/spec/gastly_spec.rb +++ b/spec/gastly_spec.rb @@ -13,9 +13,7 @@ it 'creates a screenshot' do tmp = 'spec/support/tmp' path = "#{tmp}/output.png" - expect(Dir.glob("#{tmp}/*").length).to eq 0 - Gastly.capture(url, path) - expect(Dir.glob("#{tmp}/*").length).to eq 1 + expect { Gastly.capture(url, path) }.to change { Dir.glob("#{tmp}/*").length }.by(1) FileUtils.rm Dir.glob("#{tmp}/*") end end diff --git a/spec/support/tmp/.keep b/spec/support/tmp/.keep new file mode 100644 index 0000000..e69de29