fix 0.18.2 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +36 -69
- data/lib/fix.rb +5 -8
- data/lib/fix/context.rb +147 -0
- data/lib/fix/expectation_result_not_found_error.rb +5 -0
- data/lib/fix/it.rb +15 -25
- data/lib/fix/suspicious_success_error.rb +5 -0
- data/lib/kernel.rb +9 -0
- metadata +29 -86
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -25
- data/.travis.yml +0 -28
- data/.yardopts +0 -1
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -5
- data/Rakefile +0 -23
- data/VERSION.semver +0 -1
- data/bin/console +0 -8
- data/bin/setup +0 -6
- data/checksum/fix-0.0.1.pre.gem.sha512 +0 -1
- data/checksum/fix-0.1.0.gem.sha512 +0 -1
- data/checksum/fix-0.1.0.pre.gem.sha512 +0 -1
- data/checksum/fix-0.10.0.gem.sha512 +0 -1
- data/checksum/fix-0.11.0.gem.sha512 +0 -1
- data/checksum/fix-0.11.1.gem.sha512 +0 -1
- data/checksum/fix-0.12.0.gem.sha512 +0 -1
- data/checksum/fix-0.12.1.gem.sha512 +0 -1
- data/checksum/fix-0.12.2.gem.sha512 +0 -1
- data/checksum/fix-0.12.3.gem.sha512 +0 -1
- data/checksum/fix-0.13.0.gem.sha512 +0 -1
- data/checksum/fix-0.14.0.gem.sha512 +0 -1
- data/checksum/fix-0.14.1.gem.sha512 +0 -1
- data/checksum/fix-0.15.0.gem.sha512 +0 -1
- data/checksum/fix-0.15.2.gem.sha512 +0 -1
- data/checksum/fix-0.16.0.gem.sha512 +0 -1
- data/checksum/fix-0.17.0.gem.sha512 +0 -1
- data/checksum/fix-0.17.1.gem.sha512 +0 -1
- data/checksum/fix-0.17.2.gem.sha512 +0 -1
- data/checksum/fix-0.18.0.gem.sha512 +0 -1
- data/checksum/fix-0.18.1.gem.sha512 +0 -1
- data/checksum/fix-0.2.0.gem.sha512 +0 -1
- data/checksum/fix-0.3.0.gem.sha512 +0 -1
- data/checksum/fix-0.4.0.gem.sha512 +0 -1
- data/checksum/fix-0.5.0.gem.sha512 +0 -1
- data/checksum/fix-0.6.0.gem.sha512 +0 -1
- data/checksum/fix-0.6.1.gem.sha512 +0 -1
- data/checksum/fix-0.7.0.gem.sha512 +0 -1
- data/checksum/fix-0.8.0.gem.sha512 +0 -1
- data/checksum/fix-0.9.0.gem.sha512 +0 -1
- data/checksum/fix-0.9.1.gem.sha512 +0 -1
- data/fix.gemspec +0 -29
- data/lib/fix/on.rb +0 -139
- data/lib/fix/report.rb +0 -120
- data/lib/fix/test.rb +0 -89
- data/pkg_checksum +0 -12
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-10-09 00:10:57 +0200 using RuboCop version 0.75.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 14
|
10
|
-
Style/MixinUsage:
|
11
|
-
Exclude:
|
12
|
-
- 'test/examples/duck/test_app.rb'
|
13
|
-
- 'test/examples/empty/test_app.rb'
|
14
|
-
- 'test/examples/isolation/test_app_with_isolation_1.rb'
|
15
|
-
- 'test/examples/isolation/test_app_with_isolation_2.rb'
|
16
|
-
- 'test/examples/isolation/test_app_with_isolation_3.rb'
|
17
|
-
- 'test/examples/isolation/test_app_with_isolation_4.rb'
|
18
|
-
- 'test/examples/isolation/test_app_with_isolation_5.rb'
|
19
|
-
- 'test/examples/isolation/test_app_without_isolation_1.rb'
|
20
|
-
- 'test/examples/isolation/test_app_without_isolation_2.rb'
|
21
|
-
- 'test/examples/isolation/test_app_without_isolation_3.rb'
|
22
|
-
- 'test/examples/let/test_let.rb'
|
23
|
-
- 'test/examples/operation/test_app_1.rb'
|
24
|
-
- 'test/examples/operation/test_app_2.rb'
|
25
|
-
- 'test/test_exit_status.rb'
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
before_install:
|
5
|
-
- gem install bundler
|
6
|
-
script:
|
7
|
-
- bundle exec rubocop
|
8
|
-
- bundle exec rake test
|
9
|
-
rvm:
|
10
|
-
- 2.3.8
|
11
|
-
- 2.4.5
|
12
|
-
- 2.5.3
|
13
|
-
- 2.6.3
|
14
|
-
- ruby-head
|
15
|
-
- jruby-head
|
16
|
-
- rbx-3
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- rvm: ruby-head
|
20
|
-
- rvm: jruby-head
|
21
|
-
- rvm: rbx-3
|
22
|
-
notifications:
|
23
|
-
webhooks:
|
24
|
-
urls:
|
25
|
-
- https://webhooks.gitter.im/e/a44b19cc5cf6db25fa87
|
26
|
-
on_success: change
|
27
|
-
on_failure: always
|
28
|
-
on_start: never
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
- README.md
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
|
7
|
-
RuboCop::RakeTask.new
|
8
|
-
|
9
|
-
Rake::TestTask.new do |t|
|
10
|
-
t.verbose = true
|
11
|
-
t.warning = true
|
12
|
-
t.pattern = File.join('test', '**', 'test_*.rb')
|
13
|
-
end
|
14
|
-
|
15
|
-
namespace :test do
|
16
|
-
task :coverage do
|
17
|
-
ENV['COVERAGE'] = 'true'
|
18
|
-
Rake::Task['test'].invoke
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
task(:doc_stats) { ruby '-S yard stats' }
|
23
|
-
task default: %i[test doc_stats rubocop]
|
data/VERSION.semver
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.18.2
|
data/bin/console
DELETED
data/bin/setup
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
f07e9c106cca645ba0df7a5aee870d07c41879410c2768bfb66c64e930d2b671dab08ded95d94db3f6652a93037eac5009a6b7de980b7a054aed8872fca851fe
|
@@ -1 +0,0 @@
|
|
1
|
-
fa1c66381b7d94687f9562af58230a7d6039adea59a4cad0eb8c04691d620b9f1105e796f311b884f9bdb5d9eda585834be1cafe69d8540141424bfa08df68f3
|
@@ -1 +0,0 @@
|
|
1
|
-
3ad80f61582fed9e76a0724fd5fff6138b849865a99a1ac6622ec8c29e67ee4eaae4727b97d53fd534a822c82830c57a77ba35aafaf09bff08e6e0385a8864d6
|
@@ -1 +0,0 @@
|
|
1
|
-
f5442fc31ceda7b936fbf29cff21b657dcf65c206cb1af1937453580401dfe62598a88701162a7835470961ddf5fa82ef1bfdd83ca9e3581947cf1505e82f3e1
|
@@ -1 +0,0 @@
|
|
1
|
-
3205bd172dc4bdbc7ab6f213420e43389278b1138f6cf34a595a227432a00e080513edbed75d4fd6f8387796e403344fa69b05134ca1b917a588012d61e57b52
|
@@ -1 +0,0 @@
|
|
1
|
-
c7c3e73eafdbeecc61073bd643dc7eb6e5f9686fe5e3f4bc4e23889de3dcf3598f3d4b88e813cb5023e06ef4f44c5437f1f80351459668ef8403d3248d27468e
|
@@ -1 +0,0 @@
|
|
1
|
-
b400e64d3b3b8006b6e37459ff5608001bf42d087432e2acae1f28bc56b383ecb97c6dd76c0d24bd4c0f4cc14be59d88121009501b74a8a09a26d3e4a42d7950
|
@@ -1 +0,0 @@
|
|
1
|
-
3867c77b30709a95156d9910e5be5e87ebdfa2d535c46d776aa0be149e398b660654544d478cdb8353d2ae77c5b258e9db3ef17e7b9326b56d5e5880b7be654b
|
@@ -1 +0,0 @@
|
|
1
|
-
d2bead1bb52e8ba7d03c68bb668f8c064080be66025eea22465f71cbb38f37fda2bd15e4f53ee014b2b665c9a65e5065b3b27c2b351fa17cea7cad3c1799bc3d
|
@@ -1 +0,0 @@
|
|
1
|
-
966ba13292877a34c883227f8dfe7018f7e2e0f8ac543a1b8e4749540143065ddafed82e283ee5e887c3a84e621d9e362b4ffa6d8aa5621bd3ff69e5305ca250
|
@@ -1 +0,0 @@
|
|
1
|
-
fc5d67a1e3da5d4be5c3adcd2df86b464300fd3d832430392ccc3aba6331be04fa0d827b55a6ea634910c4a46b40c336c713155a0ca5d0d9cbef663643f1bd59
|
@@ -1 +0,0 @@
|
|
1
|
-
578f4552e1e18fe8e4e8e720718901115ff8f9178f421b694c221299223eab26a2465692f4a5d7a2e03df7a212bcbba5cc2d25f5cb87577d6fe99004cd5152f7
|
@@ -1 +0,0 @@
|
|
1
|
-
99234a8fbebfeddfbc4d7665ab10b2d2f340f1f10faff21702da4040afb1e3f56041b2fe00d67b16fa0515a768de4767e6bc1fc38d0cb5d3cfcb41163593836f
|
@@ -1 +0,0 @@
|
|
1
|
-
7a17bcad2a2f195dad9435ea619728b22dbd21624c6b314a1b7901da7e2156184457ceec8871179e882a6bec9900aa625bbc253264c3df48f2fb8539fc512fa8
|
@@ -1 +0,0 @@
|
|
1
|
-
f9c633106487423399e219dc1cdea499e77dc6a9474705002924c38ce01241dbc2fbd95bb84016bcf313e7702a2d2a460b14fabcb36f08ee0c613298203cbd60
|
@@ -1 +0,0 @@
|
|
1
|
-
896c42559e7d4533e6a947f9b612e8e27f3a8531eeeee4927582cca7dfe2c11303edf3b3fed881a76129a8664235f5b58018bf16dd94b463558041dbeb4f71fe
|
@@ -1 +0,0 @@
|
|
1
|
-
3742d543a5be6586aff377abb4c97e7d9b2d6fcb8d46dce907d139c3d16a7b98ece77a4fa4acd27c5fc5bca67cd7bdfa988f9f2dd351968586de47bad8c5f4ba
|
@@ -1 +0,0 @@
|
|
1
|
-
ab08823c4799b87b57645665dd628b5bcd4cf4dccf1f10358b240ef4d23af065cc86154f25290a4e5886268a32fda9e3bce75051ba7d8a362fe0c09be6b00928
|
@@ -1 +0,0 @@
|
|
1
|
-
7f74ff80ef63a93a9baa25a7ece0b596cdb1e0f4a974580728d6f2f95ea8d7ceabd875e0f635e8ddd46b964ab48e0247ae7e9705001f6068e312ec0d8feed4c7
|
@@ -1 +0,0 @@
|
|
1
|
-
70de02a182976fa1ce086f1d64ce6e96e729a48ea93346a855d3ffdba869cce51501c6ece4f5be74dc1ddf10b85b75c3f772d05fe4e0894c1ac1cf3d36c80200
|
@@ -1 +0,0 @@
|
|
1
|
-
d492e9516ca90eda87fb0b35bc616faa251f1aaf16de21237d85e7b55471242290f31134b0b4f9eedf85c17d112b22ee9c44aaf73cb35513b0a85b3bbd3091d1
|
@@ -1 +0,0 @@
|
|
1
|
-
d36afc6b400b8112517de4c7b40d30047b595918128ac9ef75d5cd248adc8cfd6b0b3f06a71b5fe4541d45050ebbee3d8ae3fc372fd9c13d4666de2c01492044
|
@@ -1 +0,0 @@
|
|
1
|
-
7505c311763e68d85ea5272485ef103b3406bec7f63195e454586d11b4188b630448a33bd2edc97319ff497f96daa1b67fc8a1848be88cb9ea0c5a089b51bdc4
|
@@ -1 +0,0 @@
|
|
1
|
-
e75b7472e74e27649ab7605bf8cbd5621765798d07796a3d80da3440f3e9f60f5d99049cfe4811a2576d462716ff20509297b0e6b91a5baedd3414ffa43962d3
|
@@ -1 +0,0 @@
|
|
1
|
-
7c99d0d42ad0031835be2c90bf9451f27e7ee23ad75b2ff8b4ac5ded644b273d5f8af6f78c2d0ff836995d91c1f459a18de867dd6df9e4ae966ffe8012a0db20
|
@@ -1 +0,0 @@
|
|
1
|
-
e9d2df3cb5054a2e9e03e9805980d4b8081b8c25d9fac7596bc7c59f3d337d4a69bce2880b3f204eb29dbf2c2b4e6ae8d3b311bde15da49f4c415fa67bef8ef3
|
@@ -1 +0,0 @@
|
|
1
|
-
9e1ba1c6efb495ac5452611baf00dc144208c16fa54bcee1fa605bbb6e894e269de716d9b8a51d51e394f45ae85c4efa5fe9cebec433004c9c40ddb0658b024d
|
@@ -1 +0,0 @@
|
|
1
|
-
8351459bf70306c8ef0bba5d415d74e5f1fa7cfd73b70ba4ac0508989b04f70ce24e2923db1723ddd1fdad38ec2e6ac481df5a4af0adc55dc29e62ae19ed84cb
|
@@ -1 +0,0 @@
|
|
1
|
-
bdf94bb8790d1d0b5524f6ef0e7ac9a2f682cdd3248c52ef069acabbdc17ea685f050d737fa4fc121e9d7688641e2a8cd831b76537e58a6ebb5d169524f961e1
|
@@ -1 +0,0 @@
|
|
1
|
-
1acbc3c942908b08c055c50f0191f7e16681bb60388cb154bb3ca86ded0764e40438a0c296b651a8a13c4d62f1006b69c17cc69b8b6b963535be02e5fafd0d54
|
@@ -1 +0,0 @@
|
|
1
|
-
c1529ea230a72517e4d15da268661f0c06c0294f456e2bec9dcb455fd85febda7de4237466414d02a662e3a2b370471d20852138f45fc3fbb5d8fef270d9e356
|
data/fix.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'fix'
|
5
|
-
spec.version = File.read('VERSION.semver').chomp
|
6
|
-
spec.authors = ['Cyril Kato']
|
7
|
-
spec.email = ['contact@cyril.email']
|
8
|
-
|
9
|
-
spec.summary = 'Specing framework.'
|
10
|
-
spec.description = 'Specing framework for Ruby.'
|
11
|
-
spec.homepage = 'https://github.com/fixrb/fix'
|
12
|
-
spec.license = 'MIT'
|
13
|
-
|
14
|
-
spec.files =
|
15
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
|
16
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
-
spec.require_paths = ['lib']
|
18
|
-
|
19
|
-
spec.add_dependency 'aw', '~> 0.1.6'
|
20
|
-
spec.add_dependency 'defi', '~> 1.1.5'
|
21
|
-
spec.add_dependency 'spectus', '~> 3.0.9'
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
24
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
25
|
-
spec.add_development_dependency 'rubocop', '~> 0.75'
|
26
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
|
27
|
-
spec.add_development_dependency 'simplecov', '~> 0.17'
|
28
|
-
spec.add_development_dependency 'yard', '~> 0.9'
|
29
|
-
end
|
data/lib/fix/on.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'aw'
|
4
|
-
require 'defi'
|
5
|
-
|
6
|
-
module Fix
|
7
|
-
# Wraps the target of challenge.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
class On
|
12
|
-
# Initialize the on class.
|
13
|
-
#
|
14
|
-
# @param described [#object_id] The front object of the test.
|
15
|
-
# @param results [Array] The list of collected results.
|
16
|
-
# @param challenges [Array] The list of challenges to apply.
|
17
|
-
# @param helpers [Hash] The list of helpers.
|
18
|
-
# @param configuration [Hash] Settings.
|
19
|
-
def initialize(described, results, challenges, helpers, configuration)
|
20
|
-
@described = described
|
21
|
-
@results = results
|
22
|
-
@challenges = challenges
|
23
|
-
@helpers = helpers
|
24
|
-
@configuration = configuration
|
25
|
-
end
|
26
|
-
|
27
|
-
# @!attribute [r] described
|
28
|
-
#
|
29
|
-
# @return [#object_id] The front object of the test.
|
30
|
-
attr_reader :described
|
31
|
-
|
32
|
-
# @!attribute [r] results
|
33
|
-
#
|
34
|
-
# @return [Array] The list of collected results.
|
35
|
-
attr_reader :results
|
36
|
-
|
37
|
-
# @!attribute [r] challenges
|
38
|
-
#
|
39
|
-
# @return [Array] The list of challenges to apply.
|
40
|
-
attr_reader :challenges
|
41
|
-
|
42
|
-
# @!attribute [r] helpers
|
43
|
-
#
|
44
|
-
# @return [Hash] The list of helpers.
|
45
|
-
attr_reader :helpers
|
46
|
-
|
47
|
-
# @!attribute [r] configuration
|
48
|
-
#
|
49
|
-
# @return [Hash] Settings.
|
50
|
-
attr_reader :configuration
|
51
|
-
|
52
|
-
# Add it method to the DSL.
|
53
|
-
#
|
54
|
-
# @api public
|
55
|
-
#
|
56
|
-
# @example It must eql "FOO"
|
57
|
-
# it { MUST equal 'FOO' }
|
58
|
-
#
|
59
|
-
# @param spec [Proc] A spec to compare against the computed actual value.
|
60
|
-
#
|
61
|
-
# @return [Array] List of results.
|
62
|
-
def it(*, &spec)
|
63
|
-
i = It.new(described, challenges, helpers)
|
64
|
-
|
65
|
-
result = i.verify(&spec)
|
66
|
-
|
67
|
-
if configuration.fetch(:verbose, true)
|
68
|
-
print result.to_char(configuration.fetch(:color, false))
|
69
|
-
end
|
70
|
-
|
71
|
-
results << result
|
72
|
-
end
|
73
|
-
|
74
|
-
# Add on method to the DSL.
|
75
|
-
#
|
76
|
-
# @api public
|
77
|
-
#
|
78
|
-
# @example On +2, it must equal 44.
|
79
|
-
# on(:+, 2) do
|
80
|
-
# it { MUST equal 44 }
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# @param method_name [Symbol] The identifier of a method.
|
84
|
-
# @param args [Array] A list of arguments.
|
85
|
-
# @param block [Proc] A spec to compare against the computed value.
|
86
|
-
#
|
87
|
-
# @return [Array] List of results.
|
88
|
-
def on(method_name, *args, &block)
|
89
|
-
o = On.new(described,
|
90
|
-
results,
|
91
|
-
(challenges + [::Defi.send(method_name, *args)]),
|
92
|
-
helpers.dup,
|
93
|
-
configuration)
|
94
|
-
|
95
|
-
o.instance_eval(&block)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Add let method to the DSL, to define memoized helper methods.
|
99
|
-
#
|
100
|
-
# @api public
|
101
|
-
#
|
102
|
-
# @example Let's define the answer to the Ultimate Question of Life, the
|
103
|
-
# Universe, and Everything.
|
104
|
-
#
|
105
|
-
# let(:answer) { 42 }
|
106
|
-
#
|
107
|
-
# @param method_name [Symbol] The identifier of a method.
|
108
|
-
# @param block [Proc] A spec to compare against the computed value.
|
109
|
-
#
|
110
|
-
# @return [#object_id] List of results.
|
111
|
-
def let(method_name, &block)
|
112
|
-
helpers.update(method_name => block)
|
113
|
-
end
|
114
|
-
|
115
|
-
# Add context method to the DSL, to build an isolated scope.
|
116
|
-
#
|
117
|
-
# @api public
|
118
|
-
#
|
119
|
-
# @example Context when logged in.
|
120
|
-
# context 'when logged in' do
|
121
|
-
# it { MUST equal 200 }
|
122
|
-
# end
|
123
|
-
#
|
124
|
-
# @param block [Proc] A block of specs to test in isolation.
|
125
|
-
#
|
126
|
-
# @return [Array] List of results.
|
127
|
-
def context(*, &block)
|
128
|
-
o = On.new(described,
|
129
|
-
[],
|
130
|
-
challenges,
|
131
|
-
helpers.dup,
|
132
|
-
configuration)
|
133
|
-
|
134
|
-
results.concat(::Aw.fork! { o.instance_eval(&block) })
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
require_relative 'it'
|
data/lib/fix/report.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Fix
|
4
|
-
# The class that is responsible for reporting the result of the test.
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
#
|
8
|
-
class Report
|
9
|
-
# Initialize the report class.
|
10
|
-
#
|
11
|
-
# @param test [Test] The test.
|
12
|
-
def initialize(test)
|
13
|
-
@test = test
|
14
|
-
end
|
15
|
-
|
16
|
-
# @!attribute [r] test
|
17
|
-
#
|
18
|
-
# @return [Test] The results of the test.
|
19
|
-
attr_reader :test
|
20
|
-
|
21
|
-
# The report in plain text.
|
22
|
-
#
|
23
|
-
# @return [String] The report in plain text.
|
24
|
-
def to_s
|
25
|
-
[maybe_thematic_break, maybe_alerts, total_time, statistics].join
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
# @private
|
31
|
-
def maybe_thematic_break
|
32
|
-
test.results.any? && test.configuration.fetch(:verbose) ? "\n\n" : ''
|
33
|
-
end
|
34
|
-
|
35
|
-
# @private
|
36
|
-
def total_time
|
37
|
-
"Ran #{test.results.length} tests in #{test.total_time} seconds\n"
|
38
|
-
end
|
39
|
-
|
40
|
-
# @private
|
41
|
-
def alerts
|
42
|
-
test.results.reject { |r| r.to_sym.equal?(:success) }
|
43
|
-
end
|
44
|
-
|
45
|
-
# @private
|
46
|
-
def maybe_alerts
|
47
|
-
alerts.any? ? "#{results.join("\n")}\n" : ''
|
48
|
-
end
|
49
|
-
|
50
|
-
# @private
|
51
|
-
def results
|
52
|
-
alerts.map.with_index(1) do |r, i|
|
53
|
-
maybe_results_color("#{i}. #{r.message}\n" + maybe_backtrace(r), r)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# @private
|
58
|
-
def maybe_results_color(string, result)
|
59
|
-
return string unless test.configuration.fetch(:color)
|
60
|
-
|
61
|
-
color = send("#{result.to_sym}_color")
|
62
|
-
"\e[#{color}m#{string}\e[0m"
|
63
|
-
end
|
64
|
-
|
65
|
-
# @private
|
66
|
-
def maybe_backtrace(result)
|
67
|
-
result.respond_to?(:backtrace) ? " #{result.backtrace.first}\n" : ''
|
68
|
-
end
|
69
|
-
|
70
|
-
# @private
|
71
|
-
def statistics
|
72
|
-
if test.configuration.fetch(:color)
|
73
|
-
statistics_color(statistics_text, test.statistics)
|
74
|
-
else
|
75
|
-
statistics_text
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# @private
|
80
|
-
def statistics_text
|
81
|
-
"#{test.statistics.fetch(:pass_percent)}% compliant - " \
|
82
|
-
"#{test.statistics.fetch(:total_infos)} infos, " \
|
83
|
-
"#{test.statistics.fetch(:total_failures)} failures, " \
|
84
|
-
"#{test.statistics.fetch(:total_errors)} errors\n"
|
85
|
-
end
|
86
|
-
|
87
|
-
# @private
|
88
|
-
def statistics_color(string, stats)
|
89
|
-
if stats.fetch(:total_errors).positive?
|
90
|
-
"\e[#{error_color}m#{string}\e[0m"
|
91
|
-
elsif stats.fetch(:total_failures).positive?
|
92
|
-
"\e[#{failure_color}m#{string}\e[0m"
|
93
|
-
elsif stats.fetch(:total_infos).positive?
|
94
|
-
"\e[#{info_color}m#{string}\e[0m"
|
95
|
-
else
|
96
|
-
"\e[#{success_color}m#{string}\e[0m"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# @private
|
101
|
-
def error_color
|
102
|
-
31
|
103
|
-
end
|
104
|
-
|
105
|
-
# @private
|
106
|
-
def failure_color
|
107
|
-
35
|
108
|
-
end
|
109
|
-
|
110
|
-
# @private
|
111
|
-
def info_color
|
112
|
-
33
|
113
|
-
end
|
114
|
-
|
115
|
-
# @private
|
116
|
-
def success_color
|
117
|
-
32
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|