all_green 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/Gemfile +8 -0
- data/LICENSE +22 -0
- data/README.md +44 -0
- data/Rakefile +2 -0
- data/all_green.gemspec +17 -0
- data/bin/all_green +3 -0
- data/lib/all_green/base_engine.rb +28 -0
- data/lib/all_green/command_line.rb +13 -0
- data/lib/all_green/engines/rspec.rb +11 -0
- data/lib/all_green/engines/spinach.rb +13 -0
- data/lib/all_green/runner.rb +26 -0
- data/lib/all_green/version.rb +3 -0
- data/lib/all_green.rb +10 -0
- data/spec/base_engine_spec.rb +44 -0
- data/spec/runner_spec.rb +28 -0
- data/spec/spec_helper.rb +8 -0
- metadata +75 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 keybi
|
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,44 @@
|
|
1
|
+
# AllGreen
|
2
|
+
|
3
|
+
Run all your test suites (rspec, cucumber, rails unit tests and more...) using one command.
|
4
|
+
|
5
|
+
AllGreen will handle exit codes so it's perfect for using with continuous integration system.
|
6
|
+
|
7
|
+
Currently AllGreen will auto-detect :
|
8
|
+
|
9
|
+
* RSpec
|
10
|
+
* Spinach
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'all_green'
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install all_green
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Run all tests
|
29
|
+
|
30
|
+
$ bundle exec all_green
|
31
|
+
|
32
|
+
## Roadmap
|
33
|
+
|
34
|
+
* Add support for popular testing frameworks : Cucumber, MiniTest, Rails unit test
|
35
|
+
* Pass configuration options for each engine
|
36
|
+
* Set tests order
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/all_green.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/all_green/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["kbackowski"]
|
6
|
+
gem.email = ["kbackowski@gmail.com"]
|
7
|
+
gem.description = %q{Run all your test suites (rspec, cucumber, rails unit tests and more...) using one command}
|
8
|
+
gem.summary = %q{Run all your test suites (rspec, cucumber, rails unit tests and more...) using one command}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "all_green"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = AllGreen::VERSION
|
17
|
+
end
|
data/bin/all_green
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module AllGreen
|
2
|
+
class BaseEngine
|
3
|
+
def self.load
|
4
|
+
begin
|
5
|
+
self.load_gem
|
6
|
+
rescue LoadError
|
7
|
+
return false
|
8
|
+
end
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.run
|
13
|
+
result = self.run_gem
|
14
|
+
if result.is_a? Integer
|
15
|
+
result == 1 ? result = false : result = true
|
16
|
+
end
|
17
|
+
!!result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.load_gem
|
22
|
+
raise 'Not Implemented'
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.run_gem
|
26
|
+
raise 'Not Implemented'
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
module AllGreen
|
4
|
+
class Runner
|
5
|
+
def initialize
|
6
|
+
@engines = []
|
7
|
+
load_engines
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
@engines.map(&:run).all?
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def load_engines
|
17
|
+
AllGreen::Engines.constants.each do |engine_constant|
|
18
|
+
load_engine AllGreen::Engines.const_get(engine_constant, inherit = false)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def load_engine(engine)
|
23
|
+
@engines << engine if engine.load
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/all_green.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestEngine < AllGreen::BaseEngine; end
|
4
|
+
|
5
|
+
describe AllGreen::BaseEngine do
|
6
|
+
describe '.load' do
|
7
|
+
it 'should invoke .load_gem' do
|
8
|
+
TestEngine.should_receive(:load_gem)
|
9
|
+
TestEngine.load
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should return true when .load_gem is successful' do
|
13
|
+
TestEngine.stub(:load_gem)
|
14
|
+
TestEngine.load.should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should catch LoadError exception and return false' do
|
18
|
+
TestEngine.stub(:load_gem).and_raise(LoadError)
|
19
|
+
TestEngine.load.should be_false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.run' do
|
24
|
+
it 'should invoke .run_gem' do
|
25
|
+
TestEngine.should_receive(:run_gem)
|
26
|
+
TestEngine.run
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should convert exit code 0 into true' do
|
30
|
+
TestEngine.should_receive(:run_gem).and_return(0)
|
31
|
+
TestEngine.run.should be_true
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should convert exit code 1 into false' do
|
35
|
+
TestEngine.should_receive(:run_gem).and_return(1)
|
36
|
+
TestEngine.run.should be_false
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should convert return value into boolean' do
|
40
|
+
TestEngine.should_receive(:run_gem).and_return(nil)
|
41
|
+
TestEngine.run.should be_false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/runner_spec.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestEngine1 < AllGreen::BaseEngine; end
|
4
|
+
class TestEngine2 < AllGreen::BaseEngine; end
|
5
|
+
|
6
|
+
describe AllGreen::Runner do
|
7
|
+
describe '#run' do
|
8
|
+
it 'should run all loaded engines' do
|
9
|
+
subject.instance_variable_set(:@engines, [TestEngine1])
|
10
|
+
TestEngine1.should_receive(:run).and_return(0)
|
11
|
+
subject.run
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return true when all engines returns 0' do
|
15
|
+
TestEngine1.stub(:run).and_return(true)
|
16
|
+
TestEngine2.stub(:run).and_return(true)
|
17
|
+
subject.instance_variable_set(:@engines, [TestEngine1, TestEngine2])
|
18
|
+
subject.run.should be_true
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should return false when any engine returns 1' do
|
22
|
+
TestEngine1.stub(:run).and_return(true)
|
23
|
+
TestEngine2.stub(:run).and_return(false)
|
24
|
+
subject.instance_variable_set(:@engines, [TestEngine1, TestEngine2])
|
25
|
+
subject.run.should be_false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: all_green
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- kbackowski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Run all your test suites (rspec, cucumber, rails unit tests and more...)
|
15
|
+
using one command
|
16
|
+
email:
|
17
|
+
- kbackowski@gmail.com
|
18
|
+
executables:
|
19
|
+
- all_green
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- .rspec
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- all_green.gemspec
|
30
|
+
- bin/all_green
|
31
|
+
- lib/all_green.rb
|
32
|
+
- lib/all_green/base_engine.rb
|
33
|
+
- lib/all_green/command_line.rb
|
34
|
+
- lib/all_green/engines/rspec.rb
|
35
|
+
- lib/all_green/engines/spinach.rb
|
36
|
+
- lib/all_green/runner.rb
|
37
|
+
- lib/all_green/version.rb
|
38
|
+
- spec/base_engine_spec.rb
|
39
|
+
- spec/runner_spec.rb
|
40
|
+
- spec/spec_helper.rb
|
41
|
+
homepage: ''
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
hash: -232015811990800181
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
hash: -232015811990800181
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.8.21
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Run all your test suites (rspec, cucumber, rails unit tests and more...)
|
71
|
+
using one command
|
72
|
+
test_files:
|
73
|
+
- spec/base_engine_spec.rb
|
74
|
+
- spec/runner_spec.rb
|
75
|
+
- spec/spec_helper.rb
|