Skip to content

Instantly share code, notes, and snippets.

@shicholas
Created July 31, 2014 06:20
Show Gist options
  • Save shicholas/492b54d4a083a1c576af to your computer and use it in GitHub Desktop.
Save shicholas/492b54d4a083a1c576af to your computer and use it in GitHub Desktop.
Dockerized Feature specs
begin
# build Docker image
`docker build -t app .`
#
# # delete old docker containers
`docker rm (docker ps -a -q)`
# gather all the feature specs
RAILS_ROOT = File.expand_path('../..', __FILE__)
feature_specs = Dir[File.join(RAILS_ROOT, 'spec/features/**/*.rb')]
# run a feature spec in a daemonized container
feature_specs.each do |feature_test|
filename = File.basename(feature_test, ".rb")
`docker run -d --name=#{filename} app phantomjs & bundle exec #{feature_test}`
end
rescue Exception => e
puts "OH NO YOU DID SOMETHING HORRIBLY WRONG"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment