Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #36 from sevos/zeus-0.15
Browse files Browse the repository at this point in the history
Add support for Zeus 0.15
  • Loading branch information
schneidmaster committed Jul 22, 2015
2 parents d53236c + 67628b6 commit 85698f3
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 136 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -4,13 +4,16 @@
.config
.yardoc
Gemfile.lock
gemfiles/*.gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/dummy/Gemfile
spec/dummy/vendor
spec/reports
test/tmp
test/version_tmp
Expand Down
3 changes: 2 additions & 1 deletion .rspec
@@ -1,3 +1,4 @@
--color
--format progress
--require spec_helper
--require spec_helper
--exclude-pattern 'spec/dummy/**/*'
2 changes: 2 additions & 0 deletions .rubocop.yml
@@ -1,6 +1,8 @@
AllCops:
Exclude:
- bin/**/*
- vendor/**/*
- spec/dummy/vendor/**/*

Documentation:
Enabled: false
Expand Down
19 changes: 19 additions & 0 deletions Appraisals
@@ -0,0 +1,19 @@
appraise 'rails-3-zeus-0.15' do
gem 'rails', '3.2.21'
gem 'zeus', '0.15.4'
end

appraise 'rails-4-zeus-0.15' do
gem 'rails', '4.2.3'
gem 'zeus', '0.15.4'
end

appraise 'rails-3-zeus-0.13' do
gem 'rails', '3.2.21'
gem 'zeus', '0.13.3'
end

appraise 'rails-4-zeus-0.13' do
gem 'rails', '4.2.3'
gem 'zeus', '0.13.3'
end
11 changes: 0 additions & 11 deletions Rakefile
Expand Up @@ -4,14 +4,3 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task default: :spec
namespace :circle do
RSpec::Core::RakeTask.new(:spec) do |task|
file_list = FileList['spec/**/*_spec.rb']

%w(slow).each do |exclude|
file_list = file_list.exclude("spec/#{exclude}/**/*_spec.rb")
end

task.pattern = file_list
end
end
35 changes: 26 additions & 9 deletions circle.yml
@@ -1,22 +1,39 @@
dependencies:
pre:
- echo rvm_autoupdate_flag=0 >> ~/.rvmrc
- rvm install 2.2
- rvm install 2.1
- rvm install 2.0
- rvm install 1.9

cache_directories:
- '~/.rvm/gems/'
- /home/ubuntu/.rvm/gems/ruby-2.2.0
- /home/ubuntu/.rvm/gems/ruby-2.1.5
- /home/ubuntu/.rvm/gems/ruby-2.0.0-p598
- /home/ubuntu/.rvm/gems/ruby-1.9.3-p551

override:
- rvm-exec 2.2 bash -c 'bundle check || bundle install'
- rvm-exec 2.1 bash -c 'bundle check || bundle install'
- rvm-exec 2.0 bash -c 'bundle check || bundle install'
- rvm-exec 1.9 bash -c 'bundle check || bundle install'
- rvm-exec 2.2 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.15.gemfile'
- rvm-exec 2.2 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.15.gemfile'
- rvm-exec 2.2 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.13.gemfile'
- rvm-exec 2.2 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.13.gemfile'
- rvm-exec 2.1 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.15.gemfile'
- rvm-exec 2.1 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.15.gemfile'
- rvm-exec 2.1 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.13.gemfile'
- rvm-exec 2.1 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.13.gemfile'
- rvm-exec 2.0 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.15.gemfile'
- rvm-exec 2.0 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.15.gemfile'
- rvm-exec 2.0 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.13.gemfile'
- rvm-exec 2.0 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.13.gemfile'
- rvm-exec 1.9 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.15.gemfile'
- rvm-exec 1.9 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.15.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.15.gemfile'
- rvm-exec 1.9 bash -c 'bundle check --gemfile=gemfiles/rails_3_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_3_zeus_0.13.gemfile'
- rvm-exec 1.9 bash -c 'bundle check --gemfile=gemfiles/rails_4_zeus_0.13.gemfile || bundle install --gemfile=gemfiles/rails_4_zeus_0.13.gemfile'

test:
override:
- rvm-exec 2.2 bash -c 'bundle exec rake circle:spec'
- rvm-exec 2.1 bash -c 'bundle exec rake circle:spec'
- rvm-exec 2.0 bash -c 'bundle exec rake circle:spec'
- rvm-exec 1.9 bash -c 'bundle exec rake circle:spec'
- rvm-exec 2.2 bash -c 'bundle exec appraisal rspec'
- rvm-exec 2.1 bash -c 'bundle exec appraisal rspec'
- rvm-exec 2.0 bash -c 'bundle exec appraisal rspec'
- rvm-exec 1.9 bash -c 'bundle exec appraisal rspec'
- rvm-exec 2.2 bash -c 'bundle exec rubocop'
8 changes: 8 additions & 0 deletions gemfiles/rails_3_zeus_0.13.gemfile
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "3.2.21"
gem "zeus", "0.13.3"

gemspec :path => "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_3_zeus_0.15.gemfile
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "3.2.21"
gem "zeus", "0.15.4"

gemspec :path => "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_4_zeus_0.13.gemfile
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.3"
gem "zeus", "0.13.3"

gemspec :path => "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_4_zeus_0.15.gemfile
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.3"
gem "zeus", "0.15.4"

gemspec :path => "../"
14 changes: 10 additions & 4 deletions lib/zeus/parallel_tests/rails.rb
Expand Up @@ -5,6 +5,10 @@ module Zeus
module ParallelTests
class Rails < ::Zeus::Rails
def parallel_cucumber
if ENV.key?('RAILS_ENV')
puts "Warning: Deleting RAILS_ENV (which is `#{ENV['RAILS_ENV']}` as Zeus will complain about it."
ENV.delete('RAILS_ENV')
end
exec parallel_runner_command 'cucumber', ARGV
end

Expand Down Expand Up @@ -35,11 +39,13 @@ def test(argv = ARGV)
end
end

def cucumber_environment
require 'cucumber/rspec/disable_option_parser'
require 'cucumber/cli/main'
end

def cucumber(argv = ARGV)
cucumber_main = Cucumber::Cli::Main.new(argv.dup)
had_failures = cucumber_main.execute!(@cucumber_runtime)
exit_code = had_failures ? 1 : 0
exit exit_code
::Cucumber::Cli::Main.execute(argv)
end

# End of patches for Zeus
Expand Down
2 changes: 1 addition & 1 deletion lib/zeus/parallel_tests/version.rb
@@ -1,5 +1,5 @@
module Zeus
module ParallelTests
VERSION = '0.2.5'
VERSION = '0.3.0'
end
end
30 changes: 0 additions & 30 deletions spec/dummy/Gemfile

This file was deleted.

6 changes: 0 additions & 6 deletions spec/dummy/config/application.rb
Expand Up @@ -54,11 +54,5 @@ class Application < Rails::Application
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
config.active_record.whitelist_attributes = true
end
end
7 changes: 0 additions & 7 deletions spec/dummy/config/environments/development.rb
Expand Up @@ -21,11 +21,4 @@

# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin

# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict

# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
end
4 changes: 0 additions & 4 deletions spec/dummy/config/environments/production.rb
Expand Up @@ -45,8 +45,4 @@

# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify

# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
3 changes: 0 additions & 3 deletions spec/dummy/config/environments/test.rb
Expand Up @@ -29,9 +29,6 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict

# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
1 change: 1 addition & 0 deletions spec/dummy/custom_plan.rb
@@ -1,3 +1,4 @@
require 'bundler/setup'
require 'zeus/parallel_tests'

class CustomPlan < Zeus::ParallelTests::Rails
Expand Down
7 changes: 7 additions & 0 deletions spec/dummy/spec/unit_test_a_spec.rb
@@ -0,0 +1,7 @@
require 'spec_helper'

describe 'Unit A' do
it 'should be true' do
expect(true).to be true
end
end
7 changes: 7 additions & 0 deletions spec/dummy/spec/unit_test_b_spec.rb
@@ -0,0 +1,7 @@
require 'spec_helper'

describe 'Unit B' do
it 'should be true' do
expect(true).to be true
end
end
56 changes: 56 additions & 0 deletions spec/parallel_spec.rb
@@ -0,0 +1,56 @@
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)

require 'zeus/parallel_tests/version'
require 'open3'
require 'English'

describe 'zeus parallel spec' do
def launch_server
pid = fork do
Dir.chdir 'spec/dummy/' do
exec 'bundle exec zeus start > /dev/null'
end
end
sleep 3
pid
end

before(:all) do
# Copy current Appraisal gemfile to dummy app.
gemfile = File.read(ENV['BUNDLE_GEMFILE']).gsub(':path => "../"', ':path => "../../"')
File.open('spec/dummy/Gemfile', 'w+') { |f| f.write gemfile }
gemfile_lock = File.read("#{ENV['BUNDLE_GEMFILE']}.lock").gsub('remote: ../', 'remote: ../../')
File.open('spec/dummy/Gemfile.lock', 'w+') { |f| f.write gemfile_lock }

# Launch Zeus.
@server_pid = launch_server.to_s
end

it 'connects to server' do
Dir.chdir 'spec/dummy/' do
system('bundle', 'exec', 'zeus', 'r', 'true')
expect($CHILD_STATUS.success?).to be true
end
end

it 'runs rspec specs in two processes' do
Dir.chdir 'spec/dummy' do
Open3.popen2e('bundle', 'exec', 'zeus', 'parallel_rspec', '-n', '2', 'spec') do |_, output|
expect(output.to_a.map(&:chomp)).to include('2 processes for 2 specs, ~ 1 specs per process')
end
end
end

it 'runs cucumbers in two processes' do
Dir.chdir 'spec/dummy' do
Open3.popen2e('bundle', 'exec', 'zeus', 'parallel_cucumber', '-n', '2', 'features') do |_, output|
expect(output.to_a.map(&:chomp)).to include('2 processes for 2 features, ~ 1 features per process')
end
end
end

after(:all) do
system('kill', '-9', @server_pid)
system('rm', '-f', 'spec/dummy/Gemfile', 'spec/dummy/Gemfile.lock', 'spec/dummy/.zeus.sock')
end
end
53 changes: 0 additions & 53 deletions spec/slow/parallel_rspec_spec.rb

This file was deleted.

0 comments on commit 85698f3

Please sign in to comment.