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.
@@ -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
@@ -1,8 +0,0 @@
1
- require 'logger'
2
-
3
- module Thoreau
4
- class LegacyResults
5
-
6
-
7
- end
8
- end
data/lib/thoreau/setup.rb DELETED
@@ -1,15 +0,0 @@
1
- module Thoreau
2
-
3
- class Setup
4
-
5
- attr_reader :name, :values, :block
6
-
7
- def initialize name, values, block
8
- @name = name
9
- @values = values
10
- # @value = [values].flatten unless values.nil?
11
- @block = block
12
- end
13
-
14
- end
15
- end
@@ -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
-