thoreau 0.2.1 → 0.2.2
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 +4 -4
- data/lib/thoreau/auto_run.rb +5 -0
- data/lib/thoreau/case/case_builder.rb +114 -0
- data/lib/thoreau/case/context_builder.rb +3 -4
- data/lib/thoreau/case/multi_clan_case_builder.rb +27 -0
- data/lib/thoreau/case/suite_runner.rb +61 -0
- data/lib/thoreau/configuration.rb +9 -0
- data/lib/thoreau/dsl/appendix.rb +5 -5
- data/lib/thoreau/dsl/clan.rb +94 -0
- data/lib/thoreau/dsl/suite_context.rb +46 -0
- data/lib/thoreau/dsl/test_cases.rb +20 -0
- data/lib/thoreau/dsl.rb +39 -26
- data/lib/thoreau/errors.rb +15 -0
- data/lib/thoreau/legacy_expected_outcomes.rb +53 -0
- data/lib/thoreau/logging.rb +36 -0
- data/lib/thoreau/models/appendix.rb +17 -0
- data/lib/thoreau/models/outcome.rb +33 -0
- data/lib/thoreau/models/setup.rb +17 -0
- data/lib/thoreau/models/test_case.rb +110 -0
- data/lib/thoreau/models/test_clan.rb +37 -0
- data/lib/thoreau/models/test_family.rb +53 -0
- data/lib/thoreau/test_suite.rb +17 -11
- data/lib/thoreau/test_suite_data.rb +27 -0
- data/lib/thoreau/util.rb +29 -0
- data/lib/thoreau/version.rb +1 -1
- data/lib/thoreau.rb +8 -2
- metadata +34 -11
- data/lib/thoreau/case/builder.rb +0 -110
- data/lib/thoreau/case/runner.rb +0 -42
- data/lib/thoreau/case.rb +0 -97
- data/lib/thoreau/dsl/context.rb +0 -55
- data/lib/thoreau/dsl/groups.rb +0 -20
- data/lib/thoreau/dsl/groups_support.rb +0 -58
- data/lib/thoreau/legacy_results.rb +0 -8
- data/lib/thoreau/setup.rb +0 -15
- data/lib/thoreau/spec_group.rb +0 -45
data/lib/thoreau/dsl/groups.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Thoreau
|
2
|
-
module DSL
|
3
|
-
class Groups
|
4
|
-
|
5
|
-
attr_reader :context
|
6
|
-
|
7
|
-
def initialize(context)
|
8
|
-
@context = context
|
9
|
-
end
|
10
|
-
|
11
|
-
def logger *args
|
12
|
-
@context.logger *args
|
13
|
-
end
|
14
|
-
|
15
|
-
include Thoreau::DSL::GroupsSupport
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require_relative '../spec_group'
|
2
|
-
require_relative './expanded'
|
3
|
-
require 'active_support/core_ext/array/conversions'
|
4
|
-
|
5
|
-
module Thoreau
|
6
|
-
module DSL
|
7
|
-
|
8
|
-
SPEC_GROUP_NAMES = %i[happy sad spec edge edges boundary corner gigo]
|
9
|
-
# gigo = garbage in / garbage out
|
10
|
-
#
|
11
|
-
GROUP_PROPS = %w[assert asserts raises output equal equals expect expects expected legacy pending fails inputs input setup setups].sort.freeze
|
12
|
-
PROPS_SPELL_CHECKER = DidYouMean::SpellChecker.new(dictionary: GROUP_PROPS)
|
13
|
-
|
14
|
-
module GroupsSupport
|
15
|
-
# Note: requires `logger` and `context`.
|
16
|
-
SPEC_GROUP_NAMES.each do |sym|
|
17
|
-
define_method sym do |*args|
|
18
|
-
desc = args.shift if args.size > 1 && args.first.is_a?(String)
|
19
|
-
raise "Too many arguments to #{sym}!" if args.size > 1
|
20
|
-
|
21
|
-
spec = args.first || {}
|
22
|
-
spec.keys
|
23
|
-
.reject { |k| GROUP_PROPS.include? k.to_s }
|
24
|
-
.each do |k|
|
25
|
-
suggestions = PROPS_SPELL_CHECKER.correct(k)
|
26
|
-
logger.error "Ignoring unrecognized property '#{k}'."
|
27
|
-
logger.info " Did you mean #{suggestions.to_sentence}?" if suggestions.size > 0
|
28
|
-
logger.info " Available properties: #{GROUP_PROPS.to_sentence}"
|
29
|
-
end
|
30
|
-
|
31
|
-
group = SpecGroup.new asserts: spec[:assert] || spec[:asserts],
|
32
|
-
desc: desc,
|
33
|
-
expected_exception: spec[:raises],
|
34
|
-
expected_output: spec[:output] || spec[:equals] || spec[:equal] || spec[:expected] || spec[:expects],
|
35
|
-
failure_expected: spec[:pending] || spec[:fails],
|
36
|
-
input_specs: [spec[:inputs] || spec[:input] || {}].flatten,
|
37
|
-
kind: sym,
|
38
|
-
legacy: spec[:legacy],
|
39
|
-
setups: [spec[:setup], spec[:setups]].flatten.compact
|
40
|
-
logger.debug "Adding group #{group}"
|
41
|
-
context.data.groups.push(group)
|
42
|
-
group
|
43
|
-
end
|
44
|
-
|
45
|
-
define_method "#{sym}!" do |*args|
|
46
|
-
group = self.send(sym, *args)
|
47
|
-
group.focus = true
|
48
|
-
group
|
49
|
-
end
|
50
|
-
|
51
|
-
def expanded(a)
|
52
|
-
Thoreau::DSL::Expanded.new(a)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
data/lib/thoreau/setup.rb
DELETED
data/lib/thoreau/spec_group.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
module Thoreau
|
2
|
-
|
3
|
-
class SpecGroup
|
4
|
-
attr_reader :asserts,
|
5
|
-
:desc,
|
6
|
-
:expected_exception,
|
7
|
-
:expected_output,
|
8
|
-
:input_specs,
|
9
|
-
:kind,
|
10
|
-
:legacy,
|
11
|
-
:setups
|
12
|
-
attr_writer :focus
|
13
|
-
|
14
|
-
def initialize(asserts:,
|
15
|
-
desc:,
|
16
|
-
expected_exception:,
|
17
|
-
expected_output:,
|
18
|
-
failure_expected:,
|
19
|
-
input_specs:,
|
20
|
-
legacy:,
|
21
|
-
kind:,
|
22
|
-
setups:
|
23
|
-
)
|
24
|
-
@asserts = asserts
|
25
|
-
@desc = desc
|
26
|
-
@expected_exception = expected_exception
|
27
|
-
@expected_output = expected_output
|
28
|
-
@failure_expected = failure_expected
|
29
|
-
@input_specs = input_specs
|
30
|
-
@kind = kind
|
31
|
-
@legacy = legacy
|
32
|
-
@setups = setups
|
33
|
-
end
|
34
|
-
|
35
|
-
def failure_expected?
|
36
|
-
@failure_expected
|
37
|
-
end
|
38
|
-
|
39
|
-
def focused?
|
40
|
-
@focus
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|