spectus 3.0.9 → 3.1.3
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 +67 -84
- data/lib/spectus.rb +3 -5
- data/lib/spectus/exam.rb +56 -0
- data/lib/spectus/expectation_target.rb +87 -70
- data/lib/spectus/requirement_level/base.rb +50 -75
- data/lib/spectus/requirement_level/may.rb +17 -0
- data/lib/spectus/requirement_level/must.rb +17 -0
- data/lib/spectus/requirement_level/should.rb +17 -0
- data/lib/spectus/result/common.rb +174 -0
- data/lib/spectus/result/fail.rb +40 -17
- data/lib/spectus/result/pass.rb +48 -21
- metadata +87 -91
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -56
- 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/spectus-2.0.0.gem.sha512 +0 -1
- data/checksum/spectus-2.0.1.gem.sha512 +0 -1
- data/checksum/spectus-2.0.2.gem.sha512 +0 -1
- data/checksum/spectus-2.0.3.gem.sha512 +0 -1
- data/checksum/spectus-2.0.4.gem.sha512 +0 -1
- data/checksum/spectus-2.1.0.gem.sha512 +0 -1
- data/checksum/spectus-2.1.1.gem.sha512 +0 -1
- data/checksum/spectus-2.1.2.gem.sha512 +0 -1
- data/checksum/spectus-2.1.3.gem.sha512 +0 -1
- data/checksum/spectus-2.10.0.gem.sha512 +0 -1
- data/checksum/spectus-2.2.0.gem.sha512 +0 -1
- data/checksum/spectus-2.3.0.gem.sha512 +0 -1
- data/checksum/spectus-2.3.1.gem.sha512 +0 -1
- data/checksum/spectus-2.4.0.gem.sha512 +0 -1
- data/checksum/spectus-2.5.0.gem.sha512 +0 -1
- data/checksum/spectus-2.6.0.gem.sha512 +0 -1
- data/checksum/spectus-2.7.0.gem.sha512 +0 -1
- data/checksum/spectus-2.7.1.gem.sha512 +0 -1
- data/checksum/spectus-2.8.0.gem.sha512 +0 -1
- data/checksum/spectus-2.9.0.gem.sha512 +0 -1
- data/checksum/spectus-2.9.1.gem.sha512 +0 -1
- data/checksum/spectus-2.9.2.gem.sha512 +0 -1
- data/checksum/spectus-3.0.0.gem.sha512 +0 -1
- data/checksum/spectus-3.0.1.gem.sha512 +0 -1
- data/checksum/spectus-3.0.2.gem.sha512 +0 -1
- data/checksum/spectus-3.0.3.gem.sha512 +0 -1
- data/checksum/spectus-3.0.5.gem.sha512 +0 -1
- data/checksum/spectus-3.0.6.gem.sha512 +0 -1
- data/checksum/spectus-3.0.7.gem.sha512 +0 -1
- data/checksum/spectus-3.0.8.gem.sha512 +0 -1
- data/lib/spectus/matchers.rb +0 -33
- data/lib/spectus/report.rb +0 -92
- data/lib/spectus/requirement_level/high.rb +0 -27
- data/lib/spectus/requirement_level/low.rb +0 -27
- data/lib/spectus/requirement_level/medium.rb +0 -27
- data/lib/spectus/result/base.rb +0 -112
- data/lib/spectus/sandbox.rb +0 -61
- data/pkg_checksum +0 -12
- data/spectus.gemspec +0 -28
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
|
-
3.0.9
|
data/bin/console
DELETED
data/bin/setup
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
e00ef19cbae209816410c1b0e4b032a59ba70ab2e43367c934ad723d3e23a9c50c457c0963fab7d46743d82ab21f9482dbd8ceb7cab23617e37be26823d846cd
|
@@ -1 +0,0 @@
|
|
1
|
-
9e53bf80d2c965ad554b7250434aa110eb02af57df8099c72c88bb904713fbcb6561161854085bdd21192193b813c7fe2385bf29908309ef5a033c6e217fda89
|
@@ -1 +0,0 @@
|
|
1
|
-
099ab4633acf7a95dd4c4ee103ca23bea5c61e3c4f6e2d999608f802b575b42e35f6caa5688a94e556797ce44f2f331d29f6091030c3ffbcd48d66e4c106309b
|
@@ -1 +0,0 @@
|
|
1
|
-
940e7cd57595b988c887d78dfa3e09ddbc77e2f387fe3432dea085a1377b0b2cdde327aa1955ddfd98a41a7a3f5c07b42f2872a6a6b08dc9f85b04923ef6536b
|
@@ -1 +0,0 @@
|
|
1
|
-
6e76d7fa5d2a6aa49db44430ffb45e7a87e25abd2aa75ea8d26438959956d722a053ef777e286821086d94f279b986f46004677efe38026676ce70ec6428a46c
|
@@ -1 +0,0 @@
|
|
1
|
-
b0c21b8994071c60473dcb8744a6f5cd7666cfc9f6c682b39b27b45fd24ca6ff742b47c2c195a1b114bbb21bf843597a853e7ed48c4cc4d9992b8642f922b40a
|
@@ -1 +0,0 @@
|
|
1
|
-
01c0dc2a88f74f7696443426153f7d025ac796b29ef122c4330675c736e7c3021762185a6c34e34340f1a139cc59dae63e571a0d18c4cba068a6f2a9c357a431
|
@@ -1 +0,0 @@
|
|
1
|
-
630355ae4fb971f56f52b83d8cc112c2f8b3a38fedde269f527641c54581abaf230536532f1d3fb5b926dd0d4034dc886e8c5c1f0fcf59d31ed49b4ba2548fdd
|
@@ -1 +0,0 @@
|
|
1
|
-
2837aff76c22e3d8627b0c4139ba633c0032ba4b993f9cac9b0bc33897acd334d5ba9f78a5f71525dd287a4ab9eff545eff42a92e73c368630edd3690b15f47c
|
@@ -1 +0,0 @@
|
|
1
|
-
b80e4f07089d0042497b5819020ee5f0f5c0170f65391d0f579c57f904e1481e71783a31371839b3cc6d968365ccfad390471765fdf89017092cf980626a5e70
|
@@ -1 +0,0 @@
|
|
1
|
-
2c4f497d16f5d0a4898abe0fb7ab620e76fe4e21d14f3ecfca03b1c43d388cb92e6a9a3b8c228bc922147440272dfbcfd2c2dbfc1e1466638246511143e3c6f1
|
@@ -1 +0,0 @@
|
|
1
|
-
e9e35e1953104e2d428b0f217e418db3c1baecd9e011b2545f9fcba4ff7e3bba674c6b928b3d8db842a139cd7cc9806d77ebdc7f710ece4f2aecb343703e2451
|
@@ -1 +0,0 @@
|
|
1
|
-
c73bf4fc985ec06dd7876d394d32c27028e7475d77262e1f0bd4a57e688af327e4658bdc926662a43895aaf8b9b4d56404cd0720ef90c9b69090f27505863f9d
|
@@ -1 +0,0 @@
|
|
1
|
-
3ce44d084f1cd8a6cf79947912c3ae12bf397d0af3442bdd77d4e0cc1e740752b4e68ec57f9b448ecf54cd3a3f84327e86a93885e17563a420d3977fefc5dc40
|
@@ -1 +0,0 @@
|
|
1
|
-
821f1988a534c9e5e4273db904b7c025e017e851bad9b31f455de73baab0f9e13863425ae101fb1d1f88043fd9cd72866c7a97ef9303254756e9f59815d8d00b
|
@@ -1 +0,0 @@
|
|
1
|
-
607b21ae08001de99938bf1bd144f94ffb5767630b2a5837c772af592e76bf376db3d0fd4116fc71f3038dba886c5c222411a03c4745e9cffe1678d631a408a5
|
@@ -1 +0,0 @@
|
|
1
|
-
aaf1870fb4733bcef6834cd11a1f7c08b28e7fc2eb28b6cc7b6eaedb505a122396b23158b0891d246f1b983e96818c7b1fb143f2b56bb8e3f0d259c1a09a6f75
|
@@ -1 +0,0 @@
|
|
1
|
-
7d429237e89c48a3f04e6299578fb5663b977b4191bbe99c6d0db155a06b85bd8a1985e06b18794f36e9320f05743d145ae16bf8e34beef341e7a0c56491fc93
|
@@ -1 +0,0 @@
|
|
1
|
-
2f4cc7cc8d6b32effa58c91d04e2bd2baea946c55782af86b9ac51669af56368ae68bb9dfe12ea702efa88b6b67003944e59ad876899dc950f0f590c9f26bb8f
|
@@ -1 +0,0 @@
|
|
1
|
-
8be8b787e6553812a4962e801cb64268d81f45e74b4cfd7f5383b6a4335fe69df1de46c6fe4b4894c5133bacd413d4a038bd057ddf8fabe63552dac7a024036a
|
@@ -1 +0,0 @@
|
|
1
|
-
74fe82ac666429be2cb19b7c0e40936e972a739b536865927d40ae7909bbe4dbf41ac24d76a65f1d7e77da1bd813ea5c08305cc33ed7afb43f61b62bc81311fd
|
@@ -1 +0,0 @@
|
|
1
|
-
0e83a8381978176c2bc6fb82ad3b73d6dc3fc9bfa96ad0f7c09d97af253374545d6869ab6f6fd98f0c1bfa024d788ddb349adc36f0e3578727210d7a9f6fa56a
|
@@ -1 +0,0 @@
|
|
1
|
-
eec56e5b79205d9e4e3f972df15555f372bbc02ac4206e20862722ccfba23dd7bb318375187399a5c65b5f1f7f18f32198518420ec63ec215bc0afac72708a36
|
@@ -1 +0,0 @@
|
|
1
|
-
64030a2e905aff8b458d014f9e261b236e6fe38a9b912bdd9e53d37a7b894def05a7645d4694067f3b52d620bf61d13affd77e56740a1d66590ab5937eaa9a60
|
@@ -1 +0,0 @@
|
|
1
|
-
1c1ea426d4a8e24bfe3e2a23d352d7088de747ad29391010bcb62758e6f066ecacbedf272d9c82312a87190cc731d7cc2b41d7f1550e1a6fed4c45c2eda376d6
|
@@ -1 +0,0 @@
|
|
1
|
-
95c489a4bf6c4091a27e1685bbeda29395492dd6b29a5adb8fa53f9200567a0eb15887c7b730899c65e8ec338b406c5a45498377002395cb3635a32b977eee57
|
@@ -1 +0,0 @@
|
|
1
|
-
b1cf82dc5b578e2adb29623bb4782f17b636af603b784bcd90bda8fb3dd5e57e94424b9cb2fb6ab7029d31c7bda84cda0c11e527539651ffe302d6b44dcf8d83
|
@@ -1 +0,0 @@
|
|
1
|
-
940b1f35592e5730c4ad5520c79c13429bfae404c18cf84f3195fd928a2e182a884b9000ed37eca61be36af1f7c37bca1f096316f72be0df2495aa4df05a9162
|
@@ -1 +0,0 @@
|
|
1
|
-
aacb5399f7e63d5c18bd5978b79b75a3dab09daffa5c826144e0e2a61dca94dbd172992676622a2c048023253868a4c658a1c742042e3df1089e1c5dff19b964
|
@@ -1 +0,0 @@
|
|
1
|
-
a8c66f4d94650243ec088b9b7b0dd66814e4a88c7de6cadb1dd72e0703a92c9facb94dedbb138cd8e383081c8507ea622b9b3f8aced825e4080a64206afdcc70
|
data/lib/spectus/matchers.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'matchi'
|
4
|
-
|
5
|
-
module Spectus
|
6
|
-
# The module includes the list of matcher methods.
|
7
|
-
#
|
8
|
-
# @api public
|
9
|
-
#
|
10
|
-
module Matchers
|
11
|
-
::Matchi::Matchers.constants.each do |const|
|
12
|
-
name = const.to_s
|
13
|
-
.gsub(/::/, '/')
|
14
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
15
|
-
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
16
|
-
.downcase
|
17
|
-
|
18
|
-
# Define a method for the given matcher.
|
19
|
-
#
|
20
|
-
# @example Given the `Matchi::Matchers::Equal::Matcher` matcher, its
|
21
|
-
# method would be:
|
22
|
-
#
|
23
|
-
# def equal(expected)
|
24
|
-
# Matchi::Matchers::Equal::Matcher.new(expected)
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# @return [#matches?] The matcher.
|
28
|
-
define_method name do |*args|
|
29
|
-
::Matchi::Matchers.const_get(const)::Matcher.new(*args)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/lib/spectus/report.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spectus
|
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 matcher [#matches?] The matcher.
|
12
|
-
# @param negate [Boolean] Evaluate to a negative assertion.
|
13
|
-
# @param state [Sandbox] The sandbox that tested the code.
|
14
|
-
# @param result [Boolean] The result of the test.
|
15
|
-
def initialize(matcher, negate, state, result)
|
16
|
-
@matcher = matcher
|
17
|
-
@negate = negate
|
18
|
-
@state = state
|
19
|
-
@result = result
|
20
|
-
end
|
21
|
-
|
22
|
-
# @!attribute [r] matcher
|
23
|
-
#
|
24
|
-
# @return [#matches?] The matcher.
|
25
|
-
attr_reader :matcher
|
26
|
-
|
27
|
-
# The value of the negate instance variable.
|
28
|
-
#
|
29
|
-
# @return [Boolean] Evaluated to a negative assertion or not.
|
30
|
-
def negate?
|
31
|
-
@negate
|
32
|
-
end
|
33
|
-
|
34
|
-
# @!attribute [r] state
|
35
|
-
#
|
36
|
-
# @return [Sandbox] The sandbox that tested the code.
|
37
|
-
attr_reader :state
|
38
|
-
|
39
|
-
# @!attribute [r] result
|
40
|
-
#
|
41
|
-
# @return [Boolean] The result of the test.
|
42
|
-
attr_reader :result
|
43
|
-
|
44
|
-
# The message.
|
45
|
-
#
|
46
|
-
# @return [String] The message that describe the state.
|
47
|
-
def to_s
|
48
|
-
"#{title}: #{summary}#{maybe_exception}."
|
49
|
-
end
|
50
|
-
|
51
|
-
# The title of the state.
|
52
|
-
#
|
53
|
-
# @return [String] The title of the state.
|
54
|
-
def title
|
55
|
-
if result
|
56
|
-
state.got ? 'Pass' : 'Info'
|
57
|
-
else
|
58
|
-
state.exception.nil? ? 'Failure' : 'Error'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# The summary of the state.
|
63
|
-
#
|
64
|
-
# @return [String] The summary of the state.
|
65
|
-
def summary
|
66
|
-
return state.exception.message unless state.valid? || state.exception.nil?
|
67
|
-
|
68
|
-
"Expected #{state.actual.inspect}#{maybe_negate} to #{definition}"
|
69
|
-
end
|
70
|
-
|
71
|
-
# The negation, if any.
|
72
|
-
#
|
73
|
-
# @return [String] The negation, or an empty string.
|
74
|
-
def maybe_negate
|
75
|
-
negate? ? ' not' : ''
|
76
|
-
end
|
77
|
-
|
78
|
-
# The type of exception, if any.
|
79
|
-
#
|
80
|
-
# @return [String] The type of exception, or an empty string.
|
81
|
-
def maybe_exception
|
82
|
-
state.exception.nil? ? '' : " (#{state.exception.class})"
|
83
|
-
end
|
84
|
-
|
85
|
-
# The readable definition.
|
86
|
-
#
|
87
|
-
# @return [String] The readable definition string.
|
88
|
-
def definition
|
89
|
-
matcher.to_s
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base'
|
4
|
-
|
5
|
-
module Spectus
|
6
|
-
module RequirementLevel
|
7
|
-
# High requirement level's class.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
class High < Base
|
12
|
-
# Evaluate the expectation.
|
13
|
-
#
|
14
|
-
# @return [Result::Fail, Result::Pass] Report if the high expectation
|
15
|
-
# pass or fail.
|
16
|
-
def result(isolation = false)
|
17
|
-
state = sandbox(isolation)
|
18
|
-
|
19
|
-
if state.valid?
|
20
|
-
pass!(state)
|
21
|
-
else
|
22
|
-
fail!(state)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base'
|
4
|
-
|
5
|
-
module Spectus
|
6
|
-
module RequirementLevel
|
7
|
-
# Low requirement level's class.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
class Low < Base
|
12
|
-
# Evaluate the expectation.
|
13
|
-
#
|
14
|
-
# @return [Result::Fail, Result::Pass] Report if the low expectation
|
15
|
-
# pass or fail.
|
16
|
-
def result(isolation = false)
|
17
|
-
state = sandbox(isolation)
|
18
|
-
|
19
|
-
if state.valid? || state.exception.class.equal?(::NoMethodError)
|
20
|
-
pass!(state)
|
21
|
-
else
|
22
|
-
fail!(state)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base'
|
4
|
-
|
5
|
-
module Spectus
|
6
|
-
module RequirementLevel
|
7
|
-
# Medium requirement level's class.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
class Medium < Base
|
12
|
-
# Evaluate the expectation.
|
13
|
-
#
|
14
|
-
# @return [Result::Fail, Result::Pass] Report if the medium expectation
|
15
|
-
# pass or fail.
|
16
|
-
def result(isolation = false)
|
17
|
-
state = sandbox(isolation)
|
18
|
-
|
19
|
-
if state.valid? || state.exception.nil?
|
20
|
-
pass!(state)
|
21
|
-
else
|
22
|
-
fail!(state)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/spectus/result/base.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spectus
|
4
|
-
# Namespace for the results.
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
#
|
8
|
-
module Result
|
9
|
-
# Result base's module.
|
10
|
-
#
|
11
|
-
module Base
|
12
|
-
# Initialize the result class.
|
13
|
-
#
|
14
|
-
# @param message [#to_s] It is describing the actual/error value.
|
15
|
-
# @param subject [#object_id] The untrusted object to be tested.
|
16
|
-
# @param challenge [Defi::Challenge] The challenge for the subject.
|
17
|
-
# @param actual [#object_id] The value that the subject return through
|
18
|
-
# its challenge.
|
19
|
-
# @param expected [#matches?] The definition of the expected value.
|
20
|
-
# @param got [#object_id] The result of the boolean comparison
|
21
|
-
# between the actual value and the expected value.
|
22
|
-
# @param error [#exception, nil] Any possible raised exception.
|
23
|
-
# @param level [:High, :Medium, :Low] The level of the expectation.
|
24
|
-
# @param negate [Boolean] Evaluate to a negative assertion.
|
25
|
-
# @param valid [Boolean] Report if the test was true or false.
|
26
|
-
def initialize(message, subject, challenge, actual, expected, got, error,
|
27
|
-
level, negate, valid)
|
28
|
-
|
29
|
-
@message = message.to_s
|
30
|
-
@subject = subject
|
31
|
-
@challenge = challenge
|
32
|
-
@actual = actual
|
33
|
-
@expected = expected
|
34
|
-
@got = got
|
35
|
-
@error = error
|
36
|
-
@level = level
|
37
|
-
@negate = negate
|
38
|
-
@valid = valid
|
39
|
-
end
|
40
|
-
|
41
|
-
# @!attribute [r] subject
|
42
|
-
#
|
43
|
-
# @return [#object_id] The untrusted object to be tested.
|
44
|
-
attr_reader :subject
|
45
|
-
|
46
|
-
# @!attribute [r] challenge
|
47
|
-
#
|
48
|
-
# @return [Symbol] The method to call on the subject.
|
49
|
-
attr_reader :challenge
|
50
|
-
|
51
|
-
# @!attribute [r] actual
|
52
|
-
#
|
53
|
-
# @return [#object_id] The value that the subject return through its
|
54
|
-
# challenge.
|
55
|
-
attr_reader :actual
|
56
|
-
|
57
|
-
# @!attribute [r] expected
|
58
|
-
#
|
59
|
-
# @return [#matches?] The definition of the expected value.
|
60
|
-
attr_reader :expected
|
61
|
-
|
62
|
-
# @!attribute [r] got
|
63
|
-
#
|
64
|
-
# @return [#object_id] The result of the boolean comparison between the
|
65
|
-
# actual value and the expected value.
|
66
|
-
attr_reader :got
|
67
|
-
|
68
|
-
# @!attribute [r] error
|
69
|
-
#
|
70
|
-
# @return [#exception, nil] Any possible raised exception.
|
71
|
-
attr_reader :error
|
72
|
-
|
73
|
-
# @!attribute [r] level
|
74
|
-
#
|
75
|
-
# @return [:High, :Medium, :Low] The level of the expectation.
|
76
|
-
attr_reader :level
|
77
|
-
|
78
|
-
# The value of the negate instance variable.
|
79
|
-
#
|
80
|
-
# @return [Boolean] Evaluated to a negative assertion or not.
|
81
|
-
def negate?
|
82
|
-
@negate
|
83
|
-
end
|
84
|
-
|
85
|
-
# The value of the boolean comparison between the actual value and the
|
86
|
-
# expected value.
|
87
|
-
#
|
88
|
-
# @return [Boolean] The test was true or false.
|
89
|
-
def valid?
|
90
|
-
@valid
|
91
|
-
end
|
92
|
-
|
93
|
-
# Properties of the result.
|
94
|
-
#
|
95
|
-
# @return [Hash] The properties of the result.
|
96
|
-
def to_h
|
97
|
-
{
|
98
|
-
subject: subject,
|
99
|
-
challenge: challenge.to_h,
|
100
|
-
actual: actual,
|
101
|
-
expected: expected.to_h,
|
102
|
-
got: got,
|
103
|
-
error: error,
|
104
|
-
level: level,
|
105
|
-
negate: negate?,
|
106
|
-
valid: valid?,
|
107
|
-
result: result?
|
108
|
-
}
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|