rspec-celluloid 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/bin/crspec +4 -0
- data/lib/rspec/celluloid/actor.rb +15 -0
- data/lib/rspec/celluloid/command_line.rb +35 -0
- data/lib/rspec/celluloid/monkey_patch.rb +26 -0
- data/lib/rspec/celluloid/version.rb +5 -0
- data/rspec-celluloid.gemspec +23 -0
- data/spec/rspec-celluloid_spec.rb +14 -0
- data/spec/spec_helper.rb +17 -0
- metadata +111 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Michael Fairley
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Rspec::Celluloid
|
2
|
+
|
3
|
+
Run your RSpec suite in parallel on top of [Celluloid](https://github.com/celluloid/celluloid).
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/michaelfairley/rspec-celluloid.png?branch=master)](https://travis-ci.org/michaelfairley/rspec-celluloid)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rspec-celluloid'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rspec-celluloid
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Use `crspec` instead of `rspec` to run your test suite.
|
24
|
+
|
25
|
+
## TODO:
|
26
|
+
|
27
|
+
- Add a rake task like RSpec::Core::RakeTask.
|
28
|
+
- Open a PR on rspec-core to make this project less monkey-patchy and not have to require its own executable.
|
29
|
+
- Figure out how to best size the actor pool. Defaults to #CPUs, which is probably too few for the average IO bound project.
|
30
|
+
- Figure out better ways to test this.
|
31
|
+
- Restrict the formatters that can be used ("documentation" and others will have major issues running concurrently).
|
32
|
+
- Set version requirements against rspec-core and celluloid.
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/crspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rspec/celluloid/actor'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Celluloid
|
5
|
+
class CommandLine
|
6
|
+
def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
|
7
|
+
if Array === options
|
8
|
+
options = ConfigurationOptions.new(options)
|
9
|
+
options.parse_options
|
10
|
+
end
|
11
|
+
@options = options
|
12
|
+
@configuration = configuration
|
13
|
+
@world = world
|
14
|
+
end
|
15
|
+
|
16
|
+
# A modified form of RSpec::Core::CommandLine.run that runs the example groups in Celluloid actors
|
17
|
+
def run(err, out)
|
18
|
+
@configuration.error_stream = err
|
19
|
+
@configuration.output_stream ||= out
|
20
|
+
@options.configure(@configuration)
|
21
|
+
@configuration.load_spec_files
|
22
|
+
@world.announce_filters
|
23
|
+
|
24
|
+
@configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
|
25
|
+
begin
|
26
|
+
@configuration.run_hook(:before, :suite)
|
27
|
+
@world.example_groups.ordered.map {|g| RSpec::Celluloid::Actor.pool.future.run(g,reporter)}.map {|f| f.value}.all? ? 0 : @configuration.failure_exit_code
|
28
|
+
ensure
|
29
|
+
@configuration.run_hook(:after, :suite)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'rspec/celluloid/command_line'
|
3
|
+
|
4
|
+
RSpec::Core::Runner.class_eval do
|
5
|
+
def self.run(args, err=$stderr, out=$stdout)
|
6
|
+
trap_interrupt
|
7
|
+
options = RSpec::Core::ConfigurationOptions.new(args)
|
8
|
+
options.parse_options
|
9
|
+
|
10
|
+
if options.options[:drb]
|
11
|
+
raise "Can't use the drb option with rspec-celluloid"
|
12
|
+
else
|
13
|
+
RSpec::Celluloid::CommandLine.new(options).run(err, out)
|
14
|
+
end
|
15
|
+
ensure
|
16
|
+
RSpec.reset
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec::Core::Configuration.class_eval do
|
21
|
+
def files_or_directories_to_run=(*files)
|
22
|
+
files = files.flatten
|
23
|
+
files << default_path if (command == 'crspec' || Runner.running_in_drb?) && default_path && files.empty?
|
24
|
+
self.files_to_run = get_files_to_run(files)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rspec/celluloid/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rspec-celluloid"
|
8
|
+
gem.version = Rspec::Celluloid::VERSION
|
9
|
+
gem.authors = ["Michael Fairley"]
|
10
|
+
gem.email = ["michaelfairley@gmail.com"]
|
11
|
+
gem.description = %q{Run your RSpec suite in parallel on top of Celluloid}
|
12
|
+
gem.summary = %q{Run your RSpec suite in parallel on top of Celluloid}
|
13
|
+
gem.homepage = "https://github.com/michaelfairley/rspec-celluloid"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency("celluloid")
|
21
|
+
gem.add_dependency("rspec-core")
|
22
|
+
gem.add_development_dependency("rspec")
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
describe "first" do
|
2
|
+
it "is in an actor" do
|
3
|
+
expect(Celluloid).to be_actor
|
4
|
+
$actor_id = Celluloid::Actor.current.object_id
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "second" do
|
9
|
+
it "is in a different actor" do
|
10
|
+
expect(Celluloid).to be_actor
|
11
|
+
sleep 0.1 until $actor_id
|
12
|
+
expect(Celluloid::Actor.current.object_id).not_to eq $actor_id
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-celluloid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michael Fairley
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: celluloid
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec-core
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Run your RSpec suite in parallel on top of Celluloid
|
63
|
+
email:
|
64
|
+
- michaelfairley@gmail.com
|
65
|
+
executables:
|
66
|
+
- crspec
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .rspec
|
72
|
+
- .travis.yml
|
73
|
+
- Gemfile
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- bin/crspec
|
78
|
+
- lib/rspec/celluloid/actor.rb
|
79
|
+
- lib/rspec/celluloid/command_line.rb
|
80
|
+
- lib/rspec/celluloid/monkey_patch.rb
|
81
|
+
- lib/rspec/celluloid/version.rb
|
82
|
+
- rspec-celluloid.gemspec
|
83
|
+
- spec/rspec-celluloid_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
homepage: https://github.com/michaelfairley/rspec-celluloid
|
86
|
+
licenses: []
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.8.23
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Run your RSpec suite in parallel on top of Celluloid
|
109
|
+
test_files:
|
110
|
+
- spec/rspec-celluloid_spec.rb
|
111
|
+
- spec/spec_helper.rb
|