continuus_lenimentus 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +64 -6
- data/continuus_lenimentus.gemspec +2 -2
- data/lib/continuus_lenimentus/adapter.rb +14 -1
- data/lib/continuus_lenimentus/configuration.rb +1 -1
- data/lib/continuus_lenimentus/runner.rb +13 -0
- data/lib/continuus_lenimentus/save.rb +9 -1
- data/lib/continuus_lenimentus/version.rb +1 -1
- data/lib/continuus_lenimentus.rb +19 -1
- data/spec/continuus_lenimentus_spec.rb +30 -1
- data/spec/lib/continuus_lenimentus/adapter_spec.rb +44 -1
- data/spec/lib/continuus_lenimentus/runner_spec.rb +33 -0
- data/spec/lib/continuus_lenimentus/save_spec.rb +27 -5
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDAyZDBkNDQwNTU1NGJhMzA1NDcxYjg2MWJjMDlhOTdkZTFlZjRkNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGJiMGE0NTNmZjk1ZDM5NWRlZjM2ZTU4YTViOWE2MGZkODQ3YmVkMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjllOGE5NGVhNmVmZWY3NGU4ZTdlMDc3N2M5ZWM3N2UyODZlNGJjNTA5NDU4
|
10
|
+
NmU1NGJiNDdmYzY3ZTg5MzM3ZTIyMTMwZjgwZmY0MDUyMmVhYWRmMjAxNDc1
|
11
|
+
YmFkNTc0YjRlZjE5N2U1ZjhhMTgwNmM2YzkzYzQyNjM3NGM5MjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2MxODZmMWM4MzY3NDdiZTk1YjljYjE5MzM1OGUyZjRhNTA2MGEwYTUwOGM4
|
14
|
+
ODgyYWM1Mzk4MmE1ODY5MTA4MjY1NDQzN2I0NGZlMzk0MGM0M2M4MWI4YzRj
|
15
|
+
OGRmY2M5MzdjOWY4NWVhMWM0MDAwZGRlZGQ0YTQ1YWUwOTAyNzM=
|
data/README.md
CHANGED
@@ -2,13 +2,17 @@
|
|
2
2
|
|
3
3
|
# Continuus Lenimentus
|
4
4
|
|
5
|
-
A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite is run a file is generated with
|
5
|
+
A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite is run a file is generated with metrics and the state of the test suite.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
-
|
11
|
+
group :test do
|
12
|
+
gem 'rspec', '~> 2.14.1'
|
13
|
+
gem 'simplecov', '~> 0.7.1', require: false
|
14
|
+
gem 'continuus_lenimentus', '~> 0.0.3', require: false
|
15
|
+
end
|
12
16
|
|
13
17
|
And then execute:
|
14
18
|
|
@@ -35,17 +39,70 @@ Within your applications `.simplecov` file add `SimpleCov::Formatter::ContinuusL
|
|
35
39
|
|
36
40
|
And within your `spec_helper.rb` file add a configuration block if required.
|
37
41
|
|
42
|
+
**Note**: The RSpec `ContinuusLenimentusRspecFormatter` formatter currently only supports the default `progress` format.
|
43
|
+
|
38
44
|
require "simplecov"
|
39
45
|
require 'continuus_lenimentus'
|
46
|
+
|
47
|
+
RSpec.configure do |config|
|
48
|
+
config.formatter = ContinuusLenimentusRspecFormatter
|
49
|
+
end
|
40
50
|
|
41
51
|
ContinuusLenimentus.configure do |config|
|
42
|
-
config.
|
43
|
-
config.
|
52
|
+
config.encrypted = true
|
53
|
+
config.key = 'MQofYpgCMZ79shxTtgYiQFEuvPdw'
|
54
|
+
config.file = 'ci.enc'
|
44
55
|
config.directory = Dir.getwd
|
45
|
-
condig.message
|
56
|
+
condig.message = "CI generated."
|
46
57
|
end
|
47
58
|
|
48
|
-
Each time you run your spec suite a file will be generated.
|
59
|
+
Each time you run your spec suite a file will be generated, in this case `/ci.enc`.
|
60
|
+
|
61
|
+
## Generated File
|
62
|
+
|
63
|
+
Regardless of encryption the file generated will contain the following data.
|
64
|
+
|
65
|
+
{
|
66
|
+
created_at: 2013-11-07 20:49:16 +0000,
|
67
|
+
duration: 0.003154,
|
68
|
+
counts: {
|
69
|
+
example: 28,
|
70
|
+
failure: 2,
|
71
|
+
pending: 1
|
72
|
+
},
|
73
|
+
metrics: {
|
74
|
+
total_lines: 521,
|
75
|
+
coverage: {
|
76
|
+
percent: 100.0,
|
77
|
+
strength: 1.1428571428571428,
|
78
|
+
lines: 521
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
## Encryption
|
84
|
+
`Type (AES - 256)`
|
85
|
+
|
86
|
+
The generated file is encrypted by default to ensure minimal conflicts when using version control. Be sure to set your private `key` within the configuration block if your wish to use encryption.
|
87
|
+
|
88
|
+
There may be a case where you wish to append or alter the generated file before encrypting the content. In this case, be sure to set `encrypted` in the configuration block to `false`.
|
89
|
+
|
90
|
+
require "simplecov"
|
91
|
+
require 'continuus_lenimentus'
|
92
|
+
|
93
|
+
ContinuusLenimentus::Safe.new('OnTheBeach').encrypt
|
94
|
+
# => "EnjUhJkaI..."
|
95
|
+
|
96
|
+
## Decryption
|
97
|
+
`Type (AES - 256)`
|
98
|
+
|
99
|
+
The encrypted file is useless to you unless you can decrypt it.
|
100
|
+
|
101
|
+
require "simplecov"
|
102
|
+
require 'continuus_lenimentus'
|
103
|
+
|
104
|
+
ContinuusLenimentus::Safe.new(generated_content).decrypt
|
105
|
+
# => { created_at: 2013-11-07 20:49:16 +0000... }
|
49
106
|
|
50
107
|
## Configuration
|
51
108
|
|
@@ -58,6 +115,7 @@ Each time you run your spec suite a file will be generated.
|
|
58
115
|
## Requirements
|
59
116
|
|
60
117
|
* ruby > 1.9.x
|
118
|
+
* rspec-core > 2.0.x
|
61
119
|
* simplecov > 0.7.x
|
62
120
|
* gibberish > 1.3.x
|
63
121
|
|
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Chuck J hardy"]
|
10
10
|
spec.email = ["chuckjhardy@gmail.com"]
|
11
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
|
13
|
-
spec.homepage = "https://github.com/ChuckJHardy/
|
12
|
+
spec.summary = %q{A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite is run a file is generated with metrics and the state of the test suite.}
|
13
|
+
spec.homepage = "https://github.com/ChuckJHardy/ContinuusLenimentus"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -6,6 +6,10 @@ module ContinuusLenimentus
|
|
6
6
|
@result = result
|
7
7
|
end
|
8
8
|
|
9
|
+
def as_user
|
10
|
+
encrypt? ? as_json : as_hash
|
11
|
+
end
|
12
|
+
|
9
13
|
def as_json
|
10
14
|
as_hash.to_json
|
11
15
|
end
|
@@ -13,7 +17,8 @@ module ContinuusLenimentus
|
|
13
17
|
def as_hash
|
14
18
|
{
|
15
19
|
created_at: result.created_at,
|
16
|
-
|
20
|
+
duration: rspec.fetch(:duration, 0),
|
21
|
+
counts: rspec.fetch(:counts, {}),
|
17
22
|
metrics: metrics
|
18
23
|
}
|
19
24
|
end
|
@@ -21,6 +26,10 @@ module ContinuusLenimentus
|
|
21
26
|
private
|
22
27
|
attr_reader :result
|
23
28
|
|
29
|
+
def rspec
|
30
|
+
ContinuusLenimentus::Runner.rspec.results
|
31
|
+
end
|
32
|
+
|
24
33
|
def metrics
|
25
34
|
{
|
26
35
|
total_lines: result.total_lines,
|
@@ -39,5 +48,9 @@ module ContinuusLenimentus
|
|
39
48
|
def strength
|
40
49
|
result.covered_strength.nan? ? 0.0 : result.covered_strength
|
41
50
|
end
|
51
|
+
|
52
|
+
def encrypt?
|
53
|
+
ContinuusLenimentus.configuration.encrypted
|
54
|
+
end
|
42
55
|
end
|
43
56
|
end
|
@@ -9,11 +9,15 @@ module ContinuusLenimentus
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def writer
|
12
|
-
File.open(path, mode) { |file| file.puts
|
12
|
+
File.open(path, mode) { |file| file.puts data }
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
+
def data
|
18
|
+
encrypt? ? Safe.encrypt(@data) : @data
|
19
|
+
end
|
20
|
+
|
17
21
|
def mode
|
18
22
|
'w+'
|
19
23
|
end
|
@@ -21,6 +25,10 @@ module ContinuusLenimentus
|
|
21
25
|
def path
|
22
26
|
Path.full
|
23
27
|
end
|
28
|
+
|
29
|
+
def encrypt?
|
30
|
+
ContinuusLenimentus.configuration.encrypted
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
|
data/lib/continuus_lenimentus.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require "continuus_lenimentus/configuration"
|
2
|
+
require "continuus_lenimentus/runner"
|
2
3
|
require "continuus_lenimentus/version"
|
3
4
|
require "continuus_lenimentus/safe"
|
4
5
|
require "continuus_lenimentus/adapter"
|
5
6
|
require "continuus_lenimentus/path"
|
6
7
|
require "continuus_lenimentus/save"
|
7
8
|
|
9
|
+
require "rspec/core/formatters/base_text_formatter"
|
10
|
+
|
8
11
|
module ContinuusLenimentus
|
9
12
|
def self.configuration
|
10
13
|
@configuration ||= Configuration.new
|
@@ -16,12 +19,27 @@ module ContinuusLenimentus
|
|
16
19
|
end
|
17
20
|
|
18
21
|
def self.format(result)
|
19
|
-
Save.this(Adapter.new(result).
|
22
|
+
Save.this(Adapter.new(result).as_user).tap do |_|
|
20
23
|
puts ContinuusLenimentus.configuration.message
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
28
|
+
class ContinuusLenimentusRspecFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
29
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
30
|
+
ContinuusLenimentus::Runner.rspec.results = {
|
31
|
+
duration: duration,
|
32
|
+
counts: {
|
33
|
+
example: example_count,
|
34
|
+
failure: failure_count,
|
35
|
+
pending: pending_count
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
super(duration, example_count, failure_count, pending_count)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
25
43
|
class SimpleCov::Formatter::ContinuusLenimentusFormatter
|
26
44
|
def format(result)
|
27
45
|
ContinuusLenimentus.format(result)
|
@@ -27,6 +27,34 @@ describe ContinuusLenimentus do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
describe '#dump_summary' do
|
31
|
+
subject { formatter.dump_summary(duration, example_count, failure_count, pending_count) }
|
32
|
+
|
33
|
+
let(:formatter) { ContinuusLenimentusRspecFormatter.new(output) }
|
34
|
+
let(:output) { double('Output', puts: '') }
|
35
|
+
let(:runner) { ContinuusLenimentus::Runner.rspec.results }
|
36
|
+
let(:duration) { 100 }
|
37
|
+
let(:example_count) { 10 }
|
38
|
+
let(:failure_count) { 1 }
|
39
|
+
let(:pending_count) { 2 }
|
40
|
+
|
41
|
+
let(:expected_hash) do
|
42
|
+
{
|
43
|
+
duration: duration,
|
44
|
+
counts: {
|
45
|
+
example: example_count,
|
46
|
+
failure: failure_count,
|
47
|
+
pending: pending_count
|
48
|
+
}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'assigns the runner rspec results instance' do
|
53
|
+
subject
|
54
|
+
expect(runner).to eq(expected_hash)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
30
58
|
describe '#format' do
|
31
59
|
subject { formatter.format(result) }
|
32
60
|
|
@@ -45,7 +73,8 @@ describe ContinuusLenimentus do
|
|
45
73
|
|
46
74
|
let(:data) { ContinuusLenimentus::Adapter.new(result).as_json }
|
47
75
|
|
48
|
-
it '
|
76
|
+
it 'calls off to Save with Adapted results' do
|
77
|
+
ContinuusLenimentus.configuration.encrypted = true
|
49
78
|
ContinuusLenimentus::Save.should_receive(:this).with(data)
|
50
79
|
|
51
80
|
described_class.should_receive(:puts).
|
@@ -19,7 +19,8 @@ describe ContinuusLenimentus::Adapter do
|
|
19
19
|
let(:expected_hash) do
|
20
20
|
{
|
21
21
|
created_at: "2013-11-05 18:35:29 +0000",
|
22
|
-
|
22
|
+
duration: duration,
|
23
|
+
counts: rspec_counts,
|
23
24
|
metrics: {
|
24
25
|
total_lines: 21,
|
25
26
|
coverage: {
|
@@ -31,6 +32,48 @@ describe ContinuusLenimentus::Adapter do
|
|
31
32
|
}
|
32
33
|
end
|
33
34
|
|
35
|
+
let(:duration) { 0.003537 }
|
36
|
+
let(:rspec_results) do
|
37
|
+
{
|
38
|
+
duration: duration,
|
39
|
+
counts: rspec_counts
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
let(:rspec_counts) do
|
44
|
+
{
|
45
|
+
example: 100,
|
46
|
+
failure: 10,
|
47
|
+
pending: 2
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
before do
|
52
|
+
ContinuusLenimentus::Runner.rspec.results = rspec_results
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#as_user' do
|
56
|
+
subject { instance.as_user }
|
57
|
+
|
58
|
+
before { ContinuusLenimentus.configuration.encrypted = encrypted }
|
59
|
+
|
60
|
+
context 'when encrypted' do
|
61
|
+
let(:encrypted) { true }
|
62
|
+
|
63
|
+
it 'returns the json response' do
|
64
|
+
expect(subject).to be_an_instance_of(String)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when encryption' do
|
69
|
+
let(:encrypted) { false }
|
70
|
+
|
71
|
+
it 'returns the hash response' do
|
72
|
+
expect(subject).to eq(expected_hash)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
34
77
|
describe '#as_json' do
|
35
78
|
subject { instance.as_json }
|
36
79
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContinuusLenimentus::Runner do
|
4
|
+
let(:instance) { described_class.new }
|
5
|
+
|
6
|
+
describe '.rspec' do
|
7
|
+
subject { described_class.rspec }
|
8
|
+
|
9
|
+
it 'returns an instance of runner' do
|
10
|
+
expect(subject).to be_an_instance_of(ContinuusLenimentus::Runner)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#results" do
|
15
|
+
subject { instance.results }
|
16
|
+
|
17
|
+
let(:default) { {} }
|
18
|
+
let(:new) { { key: :value} }
|
19
|
+
|
20
|
+
it "returns a hash" do
|
21
|
+
expect(subject).to be_an_instance_of(Hash)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns a default hash' do
|
25
|
+
expect(subject).to eq(default)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns altered hash' do
|
29
|
+
instance.results = new
|
30
|
+
expect(subject).to eq(new)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -20,13 +20,35 @@ describe ContinuusLenimentus::Save do
|
|
20
20
|
let(:path) { 'path/to/file' }
|
21
21
|
let(:mode) { 'w+' }
|
22
22
|
let(:file) { double('File') }
|
23
|
+
let(:encrypted) { true }
|
23
24
|
|
24
|
-
|
25
|
-
ContinuusLenimentus
|
26
|
-
|
27
|
-
|
25
|
+
before do
|
26
|
+
ContinuusLenimentus.configuration.encrypted = encrypted
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with encryptd content' do
|
30
|
+
it 'writes encryped string to file' do
|
31
|
+
ContinuusLenimentus::Path.should_receive(:full).and_return(path)
|
32
|
+
ContinuusLenimentus::Safe.should_receive(:encrypt).
|
33
|
+
with(adapter).and_return('')
|
34
|
+
|
35
|
+
File.should_receive(:open).with(path, mode).and_yield(file)
|
36
|
+
file.should_receive(:puts).with('')
|
37
|
+
|
38
|
+
subject
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'without encryptd content' do
|
43
|
+
let(:encrypted) { false }
|
44
|
+
|
45
|
+
it 'writes encryped string to file' do
|
46
|
+
ContinuusLenimentus::Path.should_receive(:full).and_return(path)
|
47
|
+
File.should_receive(:open).with(path, mode).and_yield(file)
|
48
|
+
file.should_receive(:puts).with(adapter)
|
28
49
|
|
29
|
-
|
50
|
+
subject
|
51
|
+
end
|
30
52
|
end
|
31
53
|
end
|
32
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: continuus_lenimentus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuck J hardy
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/continuus_lenimentus/adapter.rb
|
101
101
|
- lib/continuus_lenimentus/configuration.rb
|
102
102
|
- lib/continuus_lenimentus/path.rb
|
103
|
+
- lib/continuus_lenimentus/runner.rb
|
103
104
|
- lib/continuus_lenimentus/safe.rb
|
104
105
|
- lib/continuus_lenimentus/save.rb
|
105
106
|
- lib/continuus_lenimentus/version.rb
|
@@ -107,10 +108,11 @@ files:
|
|
107
108
|
- spec/lib/continuus_lenimentus/adapter_spec.rb
|
108
109
|
- spec/lib/continuus_lenimentus/configuration_spec.rb
|
109
110
|
- spec/lib/continuus_lenimentus/path_spec.rb
|
111
|
+
- spec/lib/continuus_lenimentus/runner_spec.rb
|
110
112
|
- spec/lib/continuus_lenimentus/safe_spec.rb
|
111
113
|
- spec/lib/continuus_lenimentus/save_spec.rb
|
112
114
|
- spec/spec_helper.rb
|
113
|
-
homepage: https://github.com/ChuckJHardy/
|
115
|
+
homepage: https://github.com/ChuckJHardy/ContinuusLenimentus
|
114
116
|
licenses:
|
115
117
|
- MIT
|
116
118
|
metadata: {}
|
@@ -134,13 +136,13 @@ rubygems_version: 2.1.9
|
|
134
136
|
signing_key:
|
135
137
|
specification_version: 4
|
136
138
|
summary: A SimpleCov Formatter for Continuus Lenimentus Local CI. When the spec suite
|
137
|
-
is run a file is generated with
|
138
|
-
with a key to ensure minimal conflicts when using version control.
|
139
|
+
is run a file is generated with metrics and the state of the test suite.
|
139
140
|
test_files:
|
140
141
|
- spec/continuus_lenimentus_spec.rb
|
141
142
|
- spec/lib/continuus_lenimentus/adapter_spec.rb
|
142
143
|
- spec/lib/continuus_lenimentus/configuration_spec.rb
|
143
144
|
- spec/lib/continuus_lenimentus/path_spec.rb
|
145
|
+
- spec/lib/continuus_lenimentus/runner_spec.rb
|
144
146
|
- spec/lib/continuus_lenimentus/safe_spec.rb
|
145
147
|
- spec/lib/continuus_lenimentus/save_spec.rb
|
146
148
|
- spec/spec_helper.rb
|