Skip to content

Commit 975409c

Browse files
author
smoll
committed
Update Dockerfile to install phantomjs, and make guard useful
Closes #4
1 parent a00ab38 commit 975409c

File tree

4 files changed

+52
-4
lines changed

4 files changed

+52
-4
lines changed

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
FROM ubuntu:14.04
22
MAINTAINER Shujon Mollah
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN apt-get update
6+
RUN apt-get install -y \
7+
wget parallel \
8+
ruby ruby-dev \
9+
build-essential \
10+
fontconfig
11+
12+
RUN mkdir drivers
13+
RUN wget -q -P drivers https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
14+
RUN tar -C drivers -xjf /drivers/phantomjs-1.9.7-linux-x86_64.tar.bz2
15+
RUN rm -Rf /drivers/phantomjs-1.9.7-linux-x86_64.tar.bz2
16+
RUN ln -s /drivers/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
17+
RUN chmod 755 /usr/bin/phantomjs

Gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
source "https://rubygems.org"
22

3-
gem "serverspec"
43
gem "docker-api", "~> 1.21.4"
4+
gem "serverspec"
55
gem "specinfra", "2.12.7" # because of https://circleci.com/docs/docker#docker-exec
66
# Also read https://workshop.avatarnewyork.com/post/test-docker-images-with-circleci/
77

88
group :development do
99
gem "guard", "~> 2.12.6"
10+
gem "guard-rspec", "~> 4.5.2", require: false
1011
gem "guard-rubocop", "~> 1.2.0"
1112
gem "rubocop", "~> 0.32.0"
1213
end
1314

1415
group :ci do
15-
gem "yarjuf", "~> 2.0.0"
1616
gem "coveralls", "~> 0.8.1", require: false
17+
gem "yarjuf", "~> 2.0.0"
1718
end

Guardfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,31 @@ guard :rubocop, cli: ["--auto-correct"] do
1818
watch(/.+\.rb$/)
1919
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
2020
end
21+
22+
# Note: The cmd option is now required due to the increasing number of ways
23+
# rspec may be run, below are examples of the most common uses.
24+
# * bundler: 'bundle exec rspec'
25+
# * bundler binstubs: 'bin/rspec'
26+
# * spring: 'bin/rspec' (This will use spring if running and you have
27+
# installed the spring binstubs per the docs)
28+
# * zeus: 'zeus rspec' (requires the server to be started separately)
29+
# * 'just' rspec: 'rspec'
30+
31+
guard :rspec, cmd: "bundle exec rspec" do
32+
require "guard/rspec/dsl"
33+
dsl = Guard::RSpec::Dsl.new(self)
34+
35+
# Feel free to open issues for suggestions and improvements
36+
37+
# RSpec files
38+
rspec = dsl.rspec
39+
watch(rspec.spec_helper) { rspec.spec_dir }
40+
watch(rspec.spec_support) { rspec.spec_dir }
41+
watch(rspec.spec_files)
42+
43+
watch("Dockerfile") { rspec.spec_dir }
44+
45+
# Ruby files
46+
ruby = dsl.ruby
47+
dsl.watch_spec_files_for(ruby.lib_files)
48+
end

spec/Dockerfile_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ def remove(_options = {}); end
2222
expect(os_version).to include "Ubuntu 14"
2323
end
2424

25-
xit "installs required packages" do
26-
expect(package("phantomjs")).to be_installed
25+
it "installs the right version of phantomjs" do
26+
expect(phantomjs_version).to eq "1.9.7"
2727
end
2828

2929
def os_version
3030
command("lsb_release -a").stdout
3131
end
32+
33+
def phantomjs_version
34+
command("phantomjs --version").stdout.strip
35+
end
3236
end

0 commit comments

Comments
 (0)