continuus_lenimentus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +19 -0
- data/.simplecov +17 -0
- data/.travis.yml +9 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +67 -0
- data/Rakefile +1 -0
- data/continuus_lenimentus.gemspec +27 -0
- data/lib/continuus_lenimentus/adapter.rb +43 -0
- data/lib/continuus_lenimentus/configuration.rb +12 -0
- data/lib/continuus_lenimentus/path.rb +21 -0
- data/lib/continuus_lenimentus/safe.rb +35 -0
- data/lib/continuus_lenimentus/save.rb +26 -0
- data/lib/continuus_lenimentus/version.rb +3 -0
- data/lib/continuus_lenimentus.rb +30 -0
- data/spec/continuus_lenimentus_spec.rb +57 -0
- data/spec/lib/continuus_lenimentus/adapter_spec.rb +73 -0
- data/spec/lib/continuus_lenimentus/configuration_spec.rb +87 -0
- data/spec/lib/continuus_lenimentus/path_spec.rb +15 -0
- data/spec/lib/continuus_lenimentus/safe_spec.rb +23 -0
- data/spec/lib/continuus_lenimentus/save_spec.rb +32 -0
- data/spec/spec_helper.rb +18 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWU4NzAzZjhhZjA0MzcxZTU4NmI4ODY1NDJlZjBjYTBhNGZhM2M3OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjRjZjU1NmYwOWYxMTZhZTQ5MDczNjhiNmEyMGMxOWY5MDMyZDAyNQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjY1Y2ZiZGQwZTRkN2IwNDI5MDU1MzdhZDBhZTIyNzdjOWFhNjE5ZDdmZjc1
|
10
|
+
MWI0MjljYmQ5NzFjOThmZTYyZDNiOTE3MGFkOTU1YTFmZTU1MGEzYWNjM2M5
|
11
|
+
ZjE0YzFjMzkwZDVjYTcwNGI5NjcxNGY0YTAxZGIyZTMwY2Q2MjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzJkYWIxNTExMGI4OWVlZDUxYzllZWQ4ZTg0Y2JmYWUxNDg5YzJhM2VhMDVi
|
14
|
+
YzlhNjlhMzFkY2MwZGUxMTVjOTlhNDFlNDEwMmQwYTU2ZTI3ODU4YTc1ZjNm
|
15
|
+
MmQzNDhjZWYwMDRhMTVkMmJiNzVmN2M2YmVmNTFlMTAxNGU5MWM=
|
data/.coveralls.yml
ADDED
data/.gitignore
ADDED
data/.simplecov
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
|
3
|
+
SimpleCov.configure do
|
4
|
+
minimum_coverage 95
|
5
|
+
maximum_coverage_drop 5
|
6
|
+
|
7
|
+
start('rails') do
|
8
|
+
formatter SimpleCov::Formatter::MultiFormatter[
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter
|
11
|
+
]
|
12
|
+
|
13
|
+
add_group "Long files" do |src_file|
|
14
|
+
src_file.lines.count > 100
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Chuck J hardy
|
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,67 @@
|
|
1
|
+
# Continuus Lenimentus [![Build Status](https://travis-ci.org/ChuckJHardy/ContinuusLenimentus.png)](https://travis-ci.org/ChuckJHardy/ContinuusLenimentus) [![Coverage Status](https://coveralls.io/repos/ChuckJHardy/ContinuusLenimentus/badge.png?branch=feature%2Fintegration)](https://coveralls.io/r/ChuckJHardy/ContinuusLenimentus?branch=master)
|
2
|
+
|
3
|
+
A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite is run a file is generated with data on the state of the test suite. This is encrypted with a key to ensure minimal conflicts when using version control.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'continuus_lenimentus', '~> 0.0.1'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install continuus_lenimentus
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Within your applications `.simplecov` file add `SimpleCov::Formatter::ContinuusLenimentusFormatter` as a formatter.
|
22
|
+
|
23
|
+
require 'continuus_lenimentus'
|
24
|
+
|
25
|
+
SimpleCov.configure do
|
26
|
+
start('rails') do
|
27
|
+
formatter SimpleCov::Formatter::MultiFormatter[
|
28
|
+
SimpleCov::Formatter::HTMLFormatter,
|
29
|
+
SimpleCov::Formatter::ContinuusLenimentusFormatter
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
And within your `spec_helper.rb` file add a configuration block if required.
|
35
|
+
|
36
|
+
require "simplecov"
|
37
|
+
require 'continuus_lenimentus'
|
38
|
+
|
39
|
+
ContinuusLenimentus.configure do |config|
|
40
|
+
config.key = 'MQofYpgCMZ79shxTtgYiQFEuvPdw'
|
41
|
+
config.file = 'ci.enc'
|
42
|
+
config.directory = Dir.getwd
|
43
|
+
condig.message = "CI generated."
|
44
|
+
end
|
45
|
+
|
46
|
+
Each time you run your spec suite a file will be generated.
|
47
|
+
|
48
|
+
## Configuration
|
49
|
+
|
50
|
+
* `key` is used when encrypting the generated file. `wdPvuEFQiYgtTxhs97ZMCgpYfoQM`
|
51
|
+
* `file` is the name of the generated file. `continuus_lenimentus.enc`
|
52
|
+
* `directory` is the directory where the generated file will be saved. `/coverage`
|
53
|
+
* `message` is the output displayed on the screen each time the tests are run `Continuous Integration report generated.`
|
54
|
+
|
55
|
+
## Requirements
|
56
|
+
|
57
|
+
* ruby > 1.9.x
|
58
|
+
* simplecov > 0.7.x
|
59
|
+
* gibberish > 1.3.x
|
60
|
+
|
61
|
+
## Contributing [![Maintained Status](http://stillmaintained.com/ChuckJHardy/ContinuusLenimentus.png)](http://stillmaintained.com/ChuckJHardy/ContinuusLenimentus)
|
62
|
+
|
63
|
+
1. Fork it
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'continuus_lenimentus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "continuus_lenimentus"
|
8
|
+
spec.version = ContinuusLenimentus::VERSION
|
9
|
+
spec.authors = ["Chuck J hardy"]
|
10
|
+
spec.email = ["chuckjhardy@gmail.com"]
|
11
|
+
spec.description = %q{A SimpleCov Formatter for Continuus Lenimentus Local CI.}
|
12
|
+
spec.summary = %q{A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite is run a file is generated with data on the state of the test suite. This is encrypted with a key to ensure minimal conflicts when using version control.}
|
13
|
+
spec.homepage = "https://github.com/ChuckJHardy/SimpleLocalCI"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "simplecov", "~> 0.7.1"
|
22
|
+
spec.add_dependency "gibberish", "~> 1.3.1"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec", "~> 2.13.0"
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module ContinuusLenimentus
|
4
|
+
class Adapter
|
5
|
+
def initialize(result)
|
6
|
+
@result = result
|
7
|
+
end
|
8
|
+
|
9
|
+
def as_json
|
10
|
+
as_hash.to_json
|
11
|
+
end
|
12
|
+
|
13
|
+
def as_hash
|
14
|
+
{
|
15
|
+
created_at: result.created_at,
|
16
|
+
command_name: result.command_name,
|
17
|
+
metrics: metrics
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
attr_reader :result
|
23
|
+
|
24
|
+
def metrics
|
25
|
+
{
|
26
|
+
total_lines: result.total_lines,
|
27
|
+
coverage: coverage
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def coverage
|
32
|
+
{
|
33
|
+
percent: result.covered_percent,
|
34
|
+
strength: strength,
|
35
|
+
lines: result.covered_lines,
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def strength
|
40
|
+
result.covered_strength.nan? ? 0.0 : result.covered_strength
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ContinuusLenimentus
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :key, :file, :directory, :message
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
self.key = 'wdPvuEFQiYgtTxhs97ZMCgpYfoQM'
|
7
|
+
self.file = 'continuus_lenimentus.enc'
|
8
|
+
self.directory = SimpleCov.coverage_path
|
9
|
+
self.message = "Continuous Integration report generated."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ContinuusLenimentus
|
2
|
+
class Path
|
3
|
+
def self.full
|
4
|
+
new.full
|
5
|
+
end
|
6
|
+
|
7
|
+
def full
|
8
|
+
File.join(directory, file)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def file
|
14
|
+
ContinuusLenimentus.configuration.file
|
15
|
+
end
|
16
|
+
|
17
|
+
def directory
|
18
|
+
ContinuusLenimentus.configuration.directory
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'gibberish'
|
2
|
+
|
3
|
+
module ContinuusLenimentus
|
4
|
+
class Safe
|
5
|
+
def initialize(data)
|
6
|
+
@data = data
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.encrypt(data)
|
10
|
+
new(data).encrypt
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.decrypt(data)
|
14
|
+
new(data).decrypt
|
15
|
+
end
|
16
|
+
|
17
|
+
def encrypt
|
18
|
+
cipher.enc(@data)
|
19
|
+
end
|
20
|
+
|
21
|
+
def decrypt
|
22
|
+
cipher.dec(@data)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def cipher
|
28
|
+
Gibberish::AES.new(key)
|
29
|
+
end
|
30
|
+
|
31
|
+
def key
|
32
|
+
ContinuusLenimentus.configuration.key
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ContinuusLenimentus
|
2
|
+
class Save
|
3
|
+
def initialize(data)
|
4
|
+
@data = data
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.this(data)
|
8
|
+
new(data).writer
|
9
|
+
end
|
10
|
+
|
11
|
+
def writer
|
12
|
+
File.open(path, mode) { |file| file.puts Safe.encrypt(@data) }
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def mode
|
18
|
+
'w+'
|
19
|
+
end
|
20
|
+
|
21
|
+
def path
|
22
|
+
Path.full
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "continuus_lenimentus/configuration"
|
2
|
+
require "continuus_lenimentus/version"
|
3
|
+
require "continuus_lenimentus/safe"
|
4
|
+
require "continuus_lenimentus/adapter"
|
5
|
+
require "continuus_lenimentus/path"
|
6
|
+
require "continuus_lenimentus/save"
|
7
|
+
|
8
|
+
module ContinuusLenimentus
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configure
|
14
|
+
yield(configuration)
|
15
|
+
configuration
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.format(result)
|
19
|
+
Save.this(Adapter.new(result).as_json).tap do |_|
|
20
|
+
puts ContinuusLenimentus.configuration.message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class SimpleCov::Formatter::ContinuusLenimentusFormatter
|
26
|
+
def format(result)
|
27
|
+
ContinuusLenimentus.format(result)
|
28
|
+
result
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus do
|
4
|
+
let(:instance) { described_class.new }
|
5
|
+
|
6
|
+
describe '.configuration' do
|
7
|
+
subject { described_class.configuration }
|
8
|
+
|
9
|
+
it 'returns a configuration instance' do
|
10
|
+
expect(subject).to be_an_instance_of(ContinuusLenimentus::Configuration)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.configure' do
|
15
|
+
let(:new_key) { '123' }
|
16
|
+
|
17
|
+
it 'yields the current configuration' do
|
18
|
+
expect { |b| described_class.configure(&b) }.to yield_control
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns the altered configuration' do
|
22
|
+
expect(
|
23
|
+
described_class.configure { |c| c.key = new_key }
|
24
|
+
).to be_an_instance_of(ContinuusLenimentus::Configuration)
|
25
|
+
|
26
|
+
expect(described_class.configuration.key).to eql(new_key)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#format' do
|
31
|
+
subject { formatter.format(result) }
|
32
|
+
|
33
|
+
let(:formatter) { SimpleCov::Formatter::ContinuusLenimentusFormatter.new }
|
34
|
+
let(:result) do
|
35
|
+
double(
|
36
|
+
'SimpleCov::Result',
|
37
|
+
created_at: "2013-11-05 18:35:29 +0000",
|
38
|
+
command_name: "RSpec",
|
39
|
+
covered_percent: 100.0,
|
40
|
+
covered_strength: 1.1428571428571428,
|
41
|
+
covered_lines: 21,
|
42
|
+
total_lines: 21
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:data) { ContinuusLenimentus::Adapter.new(result).as_json }
|
47
|
+
|
48
|
+
it 'class off to Save with Adapted results' do
|
49
|
+
ContinuusLenimentus::Save.should_receive(:this).with(data)
|
50
|
+
|
51
|
+
described_class.should_receive(:puts).
|
52
|
+
with(ContinuusLenimentus.configuration.message)
|
53
|
+
|
54
|
+
expect(subject).to eq(result)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Adapter do
|
4
|
+
let(:instance) { described_class.new(result) }
|
5
|
+
|
6
|
+
let(:result) do
|
7
|
+
double(
|
8
|
+
'SimpleCov::Result',
|
9
|
+
created_at: "2013-11-05 18:35:29 +0000",
|
10
|
+
command_name: "RSpec",
|
11
|
+
covered_percent: 100.0,
|
12
|
+
covered_strength: strength,
|
13
|
+
covered_lines: 21,
|
14
|
+
total_lines: 21
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:strength) { 1.1428571428571428 }
|
19
|
+
let(:expected_hash) do
|
20
|
+
{
|
21
|
+
created_at: "2013-11-05 18:35:29 +0000",
|
22
|
+
command_name: "RSpec",
|
23
|
+
metrics: {
|
24
|
+
total_lines: 21,
|
25
|
+
coverage: {
|
26
|
+
percent: 100.0,
|
27
|
+
strength: strength,
|
28
|
+
lines: 21,
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#as_json' do
|
35
|
+
subject { instance.as_json }
|
36
|
+
|
37
|
+
it 'returns a string' do
|
38
|
+
expect(subject).to be_an_instance_of(String)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns expected hash' do
|
42
|
+
expect(JSON.parse(subject, symbolize_names: true)).to eq(expected_hash)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#as_hash' do
|
47
|
+
subject { instance.as_hash }
|
48
|
+
|
49
|
+
it 'returns a hash' do
|
50
|
+
expect(subject).to be_an_instance_of(Hash)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns expected hash' do
|
54
|
+
expect(subject).to eq(expected_hash)
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'coverage strength' do
|
58
|
+
context 'is a number' do
|
59
|
+
it 'returns strength' do
|
60
|
+
expect(subject[:metrics][:coverage][:strength]).to eq(strength)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'is not a number' do
|
65
|
+
let(:strength) { 0.0/0.0 }
|
66
|
+
|
67
|
+
it 'returns 0.0' do
|
68
|
+
expect(subject[:metrics][:coverage][:strength]).to eq(0.0)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Configuration do
|
4
|
+
let(:instance) { described_class.new }
|
5
|
+
|
6
|
+
describe "#key" do
|
7
|
+
subject { instance.key }
|
8
|
+
|
9
|
+
let(:default_key) { 'wdPvuEFQiYgtTxhs97ZMCgpYfoQM' }
|
10
|
+
let(:new_key) { '123' }
|
11
|
+
|
12
|
+
it "returns a string" do
|
13
|
+
expect(subject).to be_an_instance_of(String)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns a default key' do
|
17
|
+
expect(subject).to eq(default_key)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns altered key' do
|
21
|
+
instance.key = new_key
|
22
|
+
expect(subject).to eq(new_key)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#file" do
|
27
|
+
subject { instance.file }
|
28
|
+
|
29
|
+
let(:default_file) { 'continuus_lenimentus.enc' }
|
30
|
+
let(:new_file) { 'ci.enc' }
|
31
|
+
|
32
|
+
it "returns a string" do
|
33
|
+
expect(subject).to be_an_instance_of(String)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns a default file name' do
|
37
|
+
expect(subject).to eq(default_file)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns altered file name' do
|
41
|
+
instance.file = new_file
|
42
|
+
expect(subject).to eq(new_file)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#directory" do
|
47
|
+
subject { instance.directory }
|
48
|
+
|
49
|
+
let(:default_directory) { '/User/Name/Code/Project/Random/coverage' }
|
50
|
+
let(:new_directory) { '/path/to/new/file' }
|
51
|
+
|
52
|
+
before { SimpleCov.stub(coverage_path: default_directory) }
|
53
|
+
|
54
|
+
it "returns a string" do
|
55
|
+
expect(subject).to be_an_instance_of(String)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'returns a default directory' do
|
59
|
+
expect(subject).to eq(default_directory)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns altered directory' do
|
63
|
+
instance.directory = new_directory
|
64
|
+
expect(subject).to eq(new_directory)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#message" do
|
69
|
+
subject { instance.message }
|
70
|
+
|
71
|
+
let(:default_message) { 'Continuous Integration report generated.' }
|
72
|
+
let(:new_message) { 'CI Generated' }
|
73
|
+
|
74
|
+
it "returns a string" do
|
75
|
+
expect(subject).to be_an_instance_of(String)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'returns a default message' do
|
79
|
+
expect(subject).to eq(default_message)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'returns altered message' do
|
83
|
+
instance.message = new_message
|
84
|
+
expect(subject).to eq(new_message)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Path do
|
4
|
+
let(:instance) { described_class.new }
|
5
|
+
|
6
|
+
describe '#full' do
|
7
|
+
subject { instance.full }
|
8
|
+
|
9
|
+
let(:path) { "/coverage/continuus_lenimentus.enc" }
|
10
|
+
|
11
|
+
it 'returns full path name' do
|
12
|
+
expect(subject).to include(path)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Safe do
|
4
|
+
let(:str) { 'Continuus Lenimentus is a fantastic gem' }
|
5
|
+
|
6
|
+
describe '.encrypt' do
|
7
|
+
subject { described_class.encrypt(str) }
|
8
|
+
|
9
|
+
it 'returns encrypted string' do
|
10
|
+
expect(subject).to include('U2FsdGV')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.decrypt' do
|
15
|
+
subject { described_class.decrypt(data) }
|
16
|
+
|
17
|
+
let(:data) { described_class.encrypt(str) }
|
18
|
+
|
19
|
+
it 'returns original string' do
|
20
|
+
expect(subject).to eq(str)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Save do
|
4
|
+
describe '.this' do
|
5
|
+
subject { described_class.this(adapter) }
|
6
|
+
|
7
|
+
let(:adapter) { ContinuusLenimentus::Adapter.new(result).as_json }
|
8
|
+
let(:result) do
|
9
|
+
double(
|
10
|
+
'SimpleCov::Result',
|
11
|
+
created_at: "2013-11-05 18:35:29 +0000",
|
12
|
+
command_name: "RSpec",
|
13
|
+
covered_percent: 100.0,
|
14
|
+
covered_strength: 1.1428571428571428,
|
15
|
+
covered_lines: 21,
|
16
|
+
total_lines: 21
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:path) { 'path/to/file' }
|
21
|
+
let(:mode) { 'w+' }
|
22
|
+
let(:file) { double('File') }
|
23
|
+
|
24
|
+
it 'writes encryped string to file' do
|
25
|
+
ContinuusLenimentus::Path.should_receive(:full).and_return(path)
|
26
|
+
File.should_receive(:open).with(path, mode).and_yield(file)
|
27
|
+
file.should_receive(:puts).with(an_instance_of(String))
|
28
|
+
|
29
|
+
subject
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
ENV["RAILS_ENV"] ||= 'test'
|
7
|
+
|
8
|
+
require 'rspec/autorun'
|
9
|
+
require 'continuus_lenimentus'
|
10
|
+
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.order = "random"
|
15
|
+
config.filter_run :focus => true
|
16
|
+
config.color_enabled = true
|
17
|
+
config.run_all_when_everything_filtered = true
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: continuus_lenimentus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chuck J hardy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: simplecov
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gibberish
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.13.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.13.0
|
83
|
+
description: A SimpleCov Formatter for Continuus Lenimentus Local CI.
|
84
|
+
email:
|
85
|
+
- chuckjhardy@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .coveralls.yml
|
91
|
+
- .gitignore
|
92
|
+
- .simplecov
|
93
|
+
- .travis.yml
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- continuus_lenimentus.gemspec
|
99
|
+
- lib/continuus_lenimentus.rb
|
100
|
+
- lib/continuus_lenimentus/adapter.rb
|
101
|
+
- lib/continuus_lenimentus/configuration.rb
|
102
|
+
- lib/continuus_lenimentus/path.rb
|
103
|
+
- lib/continuus_lenimentus/safe.rb
|
104
|
+
- lib/continuus_lenimentus/save.rb
|
105
|
+
- lib/continuus_lenimentus/version.rb
|
106
|
+
- spec/continuus_lenimentus_spec.rb
|
107
|
+
- spec/lib/continuus_lenimentus/adapter_spec.rb
|
108
|
+
- spec/lib/continuus_lenimentus/configuration_spec.rb
|
109
|
+
- spec/lib/continuus_lenimentus/path_spec.rb
|
110
|
+
- spec/lib/continuus_lenimentus/safe_spec.rb
|
111
|
+
- spec/lib/continuus_lenimentus/save_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
homepage: https://github.com/ChuckJHardy/SimpleLocalCI
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.1.9
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite
|
137
|
+
is run a file is generated with data on the state of the test suite. This is encrypted
|
138
|
+
with a key to ensure minimal conflicts when using version control.
|
139
|
+
test_files:
|
140
|
+
- spec/continuus_lenimentus_spec.rb
|
141
|
+
- spec/lib/continuus_lenimentus/adapter_spec.rb
|
142
|
+
- spec/lib/continuus_lenimentus/configuration_spec.rb
|
143
|
+
- spec/lib/continuus_lenimentus/path_spec.rb
|
144
|
+
- spec/lib/continuus_lenimentus/safe_spec.rb
|
145
|
+
- spec/lib/continuus_lenimentus/save_spec.rb
|
146
|
+
- spec/spec_helper.rb
|