json-spec 0.1.0

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.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.gitmodules +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +960 -0
  7. data/Rakefile +10 -0
  8. data/api_documentation.md +611 -0
  9. data/cachivache/.gitignore +1 -0
  10. data/cachivache/Gemfile +4 -0
  11. data/cachivache/README.md +247 -0
  12. data/cachivache/Rakefile +19 -0
  13. data/cachivache/Vagrantfile +70 -0
  14. data/cachivache/cachivache.rb +59 -0
  15. data/cachivache/lib/let-behaviour.rb +27 -0
  16. data/cachivache/lib/rake-helper.rb +131 -0
  17. data/cachivache/lib/sh-file-context.rb +39 -0
  18. data/cachivache/lib/sh-if-context.rb +31 -0
  19. data/cachivache/stuff/.gitkeep +0 -0
  20. data/cachivache/stuff/ruby-json-spec.rb +22 -0
  21. data/examples/example-1-simple.rb +66 -0
  22. data/examples/example-2-default-expectations.rb +63 -0
  23. data/examples/example-3-each-field.rb +104 -0
  24. data/examples/example-4-to-be-as-defined-in.rb +117 -0
  25. data/examples/example-5-custom-expectations.rb +153 -0
  26. data/examples/example-6-custom-messages.rb +36 -0
  27. data/examples/example-7-full-example.rb +231 -0
  28. data/examples/fixtures.rb +77 -0
  29. data/examples/validation-printer.rb +47 -0
  30. data/json-spec.gemspec +29 -0
  31. data/lib/cabeza-de-termo/json-spec/errors/error.rb +6 -0
  32. data/lib/cabeza-de-termo/json-spec/errors/expectation-not-found-error.rb +8 -0
  33. data/lib/cabeza-de-termo/json-spec/errors/modifier-not-found-error.rb +8 -0
  34. data/lib/cabeza-de-termo/json-spec/errors/unkown-json-type-error.rb +8 -0
  35. data/lib/cabeza-de-termo/json-spec/errors/validation-error.rb +8 -0
  36. data/lib/cabeza-de-termo/json-spec/expectations-library/default-expectations/default-expectation-builder.rb +29 -0
  37. data/lib/cabeza-de-termo/json-spec/expectations-library/default-expectations/default-expectations-mapping.rb +54 -0
  38. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/block-expectation-definition.rb +16 -0
  39. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/class-expectation-definition.rb +15 -0
  40. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/expectation-definition.rb +19 -0
  41. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/expectations-definition-builder.rb +136 -0
  42. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/expecting-all-of-expectation-definition.rb +23 -0
  43. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/expecting-any-of-expectation-definition.rb +23 -0
  44. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/expecting-expectation-definition.rb +17 -0
  45. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-builders/negating-expectation-definition.rb +16 -0
  46. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/expectation-library-definition-builder.rb +35 -0
  47. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/modifier-builders/class-modifier-definition.rb +15 -0
  48. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/modifier-builders/composing-modifiers-definition.rb +28 -0
  49. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/modifier-builders/modifier-definition.rb +13 -0
  50. data/lib/cabeza-de-termo/json-spec/expectations-library/definition-builders/modifier-builders/modifiers-definition-builder.rb +73 -0
  51. data/lib/cabeza-de-termo/json-spec/expectations-library/expectations-library.rb +150 -0
  52. data/lib/cabeza-de-termo/json-spec/expectations-library/initializers/default-library-initializer.rb +265 -0
  53. data/lib/cabeza-de-termo/json-spec/expectations-library/initializers/library-initializer.rb +9 -0
  54. data/lib/cabeza-de-termo/json-spec/expectations-library/messages/expectation-messages-mapping.rb +27 -0
  55. data/lib/cabeza-de-termo/json-spec/expectations/abstract-expectation.rb +39 -0
  56. data/lib/cabeza-de-termo/json-spec/expectations/all-expectations-composite.rb +33 -0
  57. data/lib/cabeza-de-termo/json-spec/expectations/any-expectation-composite.rb +33 -0
  58. data/lib/cabeza-de-termo/json-spec/expectations/block-expectation.rb +28 -0
  59. data/lib/cabeza-de-termo/json-spec/expectations/expectation.rb +51 -0
  60. data/lib/cabeza-de-termo/json-spec/expectations/is-email-expectation.rb +16 -0
  61. data/lib/cabeza-de-termo/json-spec/expectations/is-scalar-expectation.rb +17 -0
  62. data/lib/cabeza-de-termo/json-spec/expectations/is-url-expectation.rb +21 -0
  63. data/lib/cabeza-de-termo/json-spec/expectations/negated-expectation.rb +31 -0
  64. data/lib/cabeza-de-termo/json-spec/expectations/runner/abstract-expectations-runner.rb +27 -0
  65. data/lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb +50 -0
  66. data/lib/cabeza-de-termo/json-spec/expectations/runner/can-be-null-expectations-runner.rb +48 -0
  67. data/lib/cabeza-de-termo/json-spec/expectations/runner/expectations-runner.rb +43 -0
  68. data/lib/cabeza-de-termo/json-spec/expressions/json-any-of.rb +62 -0
  69. data/lib/cabeza-de-termo/json-spec/expressions/json-anything.rb +16 -0
  70. data/lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb +58 -0
  71. data/lib/cabeza-de-termo/json-spec/expressions/json-each.rb +58 -0
  72. data/lib/cabeza-de-termo/json-spec/expressions/json-expression.rb +314 -0
  73. data/lib/cabeza-de-termo/json-spec/expressions/json-field-name.rb +16 -0
  74. data/lib/cabeza-de-termo/json-spec/expressions/json-field.rb +76 -0
  75. data/lib/cabeza-de-termo/json-spec/expressions/json-list.rb +40 -0
  76. data/lib/cabeza-de-termo/json-spec/expressions/json-object.rb +82 -0
  77. data/lib/cabeza-de-termo/json-spec/expressions/json-scalar.rb +20 -0
  78. data/lib/cabeza-de-termo/json-spec/expressions/json-spec.rb +174 -0
  79. data/lib/cabeza-de-termo/json-spec/instantiators/abstract-instantiator.rb +9 -0
  80. data/lib/cabeza-de-termo/json-spec/instantiators/all-expectations-composite-instantiator.rb +12 -0
  81. data/lib/cabeza-de-termo/json-spec/instantiators/any-expectation-composite-instantiator.rb +12 -0
  82. data/lib/cabeza-de-termo/json-spec/instantiators/block-expectation-instantiator.rb +16 -0
  83. data/lib/cabeza-de-termo/json-spec/instantiators/composite-instantiator.rb +45 -0
  84. data/lib/cabeza-de-termo/json-spec/instantiators/modifier-composite-instantiator.rb +12 -0
  85. data/lib/cabeza-de-termo/json-spec/instantiators/negated-expectation-instantiator.rb +20 -0
  86. data/lib/cabeza-de-termo/json-spec/instantiators/patial-application-instantiator.rb +26 -0
  87. data/lib/cabeza-de-termo/json-spec/json-spec.rb +2 -0
  88. data/lib/cabeza-de-termo/json-spec/message-formatters/block-message-formatter.rb +15 -0
  89. data/lib/cabeza-de-termo/json-spec/message-formatters/erb-message-formatter.rb +60 -0
  90. data/lib/cabeza-de-termo/json-spec/message-formatters/message-formatter.rb +9 -0
  91. data/lib/cabeza-de-termo/json-spec/metaprogramming/message-send.rb +37 -0
  92. data/lib/cabeza-de-termo/json-spec/metaprogramming/message.rb +37 -0
  93. data/lib/cabeza-de-termo/json-spec/metaprogramming/object-method.rb +14 -0
  94. data/lib/cabeza-de-termo/json-spec/modifiers/can-be-absent-modifier.rb +13 -0
  95. data/lib/cabeza-de-termo/json-spec/modifiers/can-be-null-modifier.rb +13 -0
  96. data/lib/cabeza-de-termo/json-spec/modifiers/expression-modifier.rb +9 -0
  97. data/lib/cabeza-de-termo/json-spec/modifiers/modifier-composite.rb +27 -0
  98. data/lib/cabeza-de-termo/json-spec/signals/signal.rb +6 -0
  99. data/lib/cabeza-de-termo/json-spec/signals/skip-branch-signal.rb +8 -0
  100. data/lib/cabeza-de-termo/json-spec/utilities/bind.rb +20 -0
  101. data/lib/cabeza-de-termo/json-spec/utilities/range.rb +70 -0
  102. data/lib/cabeza-de-termo/json-spec/value-holders/accessors-chain.rb +27 -0
  103. data/lib/cabeza-de-termo/json-spec/value-holders/missing-value.rb +21 -0
  104. data/lib/cabeza-de-termo/json-spec/value-holders/value-holder.rb +135 -0
  105. data/lib/cabeza-de-termo/json-spec/version.rb +5 -0
  106. data/lib/cabeza-de-termo/json-spec/walkers/expression-walker.rb +66 -0
  107. data/lib/cabeza-de-termo/json-spec/walkers/json-expectations-runner.rb +214 -0
  108. data/lib/cabeza-de-termo/json-spec/walkers/json-expression-explainer.rb +183 -0
  109. data/lib/cabeza-de-termo/json-spec/walkers/reporter/expectation-report.rb +63 -0
  110. data/lib/cabeza-de-termo/json-spec/walkers/reporter/json-expectations-reporter.rb +111 -0
  111. data/lib/cabeza-de-termo/json-spec/walkers/validator/json-validator-error.rb +29 -0
  112. data/lib/cabeza-de-termo/json-spec/walkers/validator/json-validator.rb +133 -0
  113. data/lib/cabeza-de-termo/json-spec/walkers/value-holders-stack-behaviour.rb +57 -0
  114. metadata +242 -0
@@ -0,0 +1,47 @@
1
+ require 'colorize'
2
+
3
+ class ValidationPrinter
4
+ def print_report_of(validator)
5
+ @validator = validator
6
+
7
+ report_errors
8
+
9
+ separator
10
+
11
+ report_unexpected_fields
12
+
13
+ separator
14
+ end
15
+
16
+ def validator()
17
+ @validator
18
+ end
19
+
20
+ def report_errors()
21
+ puts "- Failed expectations: #{validator.errors_count}".colorize(errors_color)
22
+
23
+ validator.errors.each do |error|
24
+ puts "\tField: '#{error.accessors_chain}'\t message: \"#{error.message}\"".colorize(errors_color)
25
+ end
26
+ end
27
+
28
+ def report_unexpected_fields()
29
+ puts "- Unexpected fields: #{validator.unexpected_fields_count}".colorize(unexpected_fields_color)
30
+
31
+ validator.unexpected_fields.each do |error|
32
+ puts "\tField: '#{error.accessors_chain}'\t message: \"#{error.message}\"".colorize(unexpected_fields_color)
33
+ end
34
+ end
35
+
36
+ def separator()
37
+ puts "\n"
38
+ end
39
+
40
+ def errors_color()
41
+ validator.has_errors? ? :red : :green
42
+ end
43
+
44
+ def unexpected_fields_color()
45
+ validator.has_unexpected_fields? ? :yellow : :green
46
+ end
47
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cabeza-de-termo/json-spec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "json-spec"
8
+ spec.version = CabezaDeTermo::JsonSpec::VERSION
9
+ spec.authors = ["Martin Rubi"]
10
+ spec.email = ["martin.rubi@gmail.com"]
11
+
12
+ spec.summary = %q{A framework to declare expectations on a json format and validate that a json object satisfies those expectations.}
13
+ spec.description = %q{You can use this json expectations to validate jsons you send or receive in your application, or to test your API with unit tests.}
14
+ spec.homepage = "https://github.com/cabeza-de-termo/ruby-json-spec"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "validates_email_format_of", "~> 1.6"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest"
27
+ spec.add_development_dependency "colorize"
28
+ spec.add_development_dependency "simplecov"
29
+ end
@@ -0,0 +1,6 @@
1
+ module CabezaDeTermo
2
+ module JsonSpec
3
+ class Error < StandardError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'error'
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class ExpectationNotFoundError < Error
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'error'
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class ModifierNotFoundError < Error
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'error'
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class UnkownJsonTypeError < Error
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'error'
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class ValidationError < Error
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,29 @@
1
+ require 'cabeza-de-termo/json-spec/metaprogramming/message'
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class DefaultExpectationBuilder
6
+ def initialize(expectations_mapping, json_expression_type)
7
+ @expectations_mapping = expectations_mapping
8
+ @json_expression_type = json_expression_type
9
+ end
10
+
11
+ def expectations_mapping
12
+ @expectations_mapping
13
+ end
14
+
15
+ def json_expression_type
16
+ @json_expression_type
17
+ end
18
+
19
+ def method_missing(method_name, *args)
20
+ expectations_mapping.add_expectation(
21
+ json_expression_type,
22
+ Message.new(method_name.to_sym, *args)
23
+ )
24
+
25
+ self
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,54 @@
1
+ require_relative "default-expectation-builder"
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class DefaultExpectationsMapping
6
+ def initialize()
7
+ @default_expectations = {}
8
+
9
+ drop_all_expectations
10
+ end
11
+
12
+ def drop_all_expectations()
13
+ drop_expectations_for(:objects)
14
+ drop_expectations_for(:lists)
15
+ drop_expectations_for(:fields)
16
+ drop_expectations_for(:scalars)
17
+ end
18
+
19
+ def add_expectation(json_expression_type, message)
20
+ @default_expectations[json_expression_type] << message
21
+ self
22
+ end
23
+
24
+ def expectations_for(json_expression_type)
25
+ @default_expectations[json_expression_type]
26
+ end
27
+
28
+ def drop_expectations_for(json_expression_type)
29
+ @default_expectations[json_expression_type] = []
30
+ self
31
+ end
32
+
33
+ def for_every_object(&block)
34
+ for_every_expression_of(:objects, &block)
35
+ end
36
+
37
+ def for_every_list(&block)
38
+ for_every_expression_of(:lists, &block)
39
+ end
40
+
41
+ def for_every_field(&block)
42
+ for_every_expression_of(:fields, &block)
43
+ end
44
+
45
+ def for_every_scalar(&block)
46
+ for_every_expression_of(:scalars, &block)
47
+ end
48
+
49
+ def for_every_expression_of(json_expression_type, &block)
50
+ Bind.evaluation of: block, to: DefaultExpectationBuilder.new(self, json_expression_type)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,16 @@
1
+ require_relative "expectation-definition"
2
+ require 'cabeza-de-termo/json-spec/instantiators/block-expectation-instantiator'
3
+
4
+ module CabezaDeTermo
5
+ module JsonSpec
6
+ class BlockExpectationDefinition < ExpectationDefinition
7
+ def block(block)
8
+ @block = block
9
+ end
10
+
11
+ def expectation_instantiator()
12
+ BlockExpectationInstantiator.new(@block)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ require_relative "expectation-definition"
2
+
3
+ module CabezaDeTermo
4
+ module JsonSpec
5
+ class ClassExpectationDefinition < ExpectationDefinition
6
+ def klass(klass)
7
+ @klass = klass
8
+ end
9
+
10
+ def expectation_instantiator()
11
+ @klass
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module CabezaDeTermo
2
+ module JsonSpec
3
+ class ExpectationDefinition
4
+ def initialize(expectations_library)
5
+ @expectations_library = expectations_library
6
+ end
7
+
8
+ def modifier_instantiator
9
+ raise 'Subclass responsibility'
10
+ end
11
+
12
+ protected
13
+
14
+ def expectation_instantiator_for(expectation_method)
15
+ @expectations_library.expectation_instantiator_for(expectation_method)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,136 @@
1
+ require_relative "class-expectation-definition"
2
+ require_relative "block-expectation-definition"
3
+ require_relative "negating-expectation-definition"
4
+ require_relative "expecting-expectation-definition"
5
+ require_relative "expecting-any-of-expectation-definition"
6
+ require_relative "expecting-all-of-expectation-definition"
7
+
8
+ require "cabeza-de-termo/json-spec/message-formatters/block-message-formatter"
9
+ require "cabeza-de-termo/json-spec/message-formatters/erb-message-formatter"
10
+
11
+ module CabezaDeTermo
12
+ module JsonSpec
13
+ class ExpectationsDefinitionBuilder
14
+ def self.for(expectations_library, &block)
15
+ new(expectations_library, &block)
16
+ end
17
+
18
+ def initialize(expectations_library, &block)
19
+ @expectations_library = expectations_library
20
+ reset_current_definition
21
+
22
+ Bind.evaluation of: block, to: self
23
+ end
24
+
25
+ # Accessing
26
+
27
+ def expectations_library
28
+ @expectations_library
29
+ end
30
+
31
+ def method_name
32
+ @method_name
33
+ end
34
+
35
+ def definition
36
+ @definition
37
+ end
38
+
39
+ # Asking
40
+
41
+ def has_expectation_definition?
42
+ !@definition.nil?
43
+ end
44
+
45
+ def has_message_definition?
46
+ !@message_formatter.nil?
47
+ end
48
+
49
+ # Building definition
50
+
51
+ def reset_current_definition
52
+ @method_name = nil
53
+ @definition = nil
54
+ @message_formatter = nil
55
+ end
56
+
57
+ def define(method_name, &block)
58
+ @method_name = method_name.to_sym
59
+
60
+ Bind.evaluation of: block, to: self
61
+
62
+ define_expectation_in_library
63
+ define_expectation_message_in_library
64
+
65
+ reset_current_definition
66
+ end
67
+
68
+ def with_class(klass)
69
+ @definition = ClassExpectationDefinition.new(expectations_library)
70
+ @definition.klass klass
71
+ end
72
+
73
+ def with_block(&block)
74
+ @definition = BlockExpectationDefinition.new(expectations_library)
75
+ @definition.block block
76
+ end
77
+
78
+ def negating(expectation_method)
79
+ @definition = NegatingExpectationDefinition.new(expectations_library)
80
+ @definition.negate expectation_method
81
+ end
82
+
83
+ def expecting(expectation_method, *args)
84
+ @definition = ExpectingExpectationDefinition.new(expectations_library)
85
+ @definition.expect(expectation_method, *args)
86
+ end
87
+
88
+ def expecting_any_of(expectation_method, *args)
89
+ @definition = ExpectingAnyOfExpectationDefinition.new(expectations_library)
90
+ @definition.or_also(expectation_method, *args)
91
+ end
92
+
93
+ def expecting_all_of(expectation_method, *args)
94
+ @definition = ExpectingAllOfExpectationDefinition.new(expectations_library)
95
+ @definition.and_also(expectation_method, *args)
96
+ end
97
+
98
+ # Message block definition
99
+
100
+ def message_formatter(message_formatter)
101
+ @message_formatter = message_formatter
102
+ end
103
+
104
+ def message(message)
105
+ message_formatter ErbMessageFormatter.new(message)
106
+ end
107
+
108
+ def message_block(&block)
109
+ message_formatter BlockMessageFormatter.new(block)
110
+ end
111
+
112
+ def define_expectation_in_library
113
+ return unless has_expectation_definition?
114
+
115
+ expectations_library.define_expectation(method_name, expectation_instantiator)
116
+ end
117
+
118
+ def define_expectation_message_in_library
119
+ return unless has_message_definition?
120
+
121
+ expectations_library.define_message_formatter_for(method_name, @message_formatter)
122
+ end
123
+
124
+ def expectation_instantiator
125
+ definition.expectation_instantiator
126
+ end
127
+
128
+ # Messages delegation
129
+
130
+ # Delegate every method to the current definition builder
131
+ def method_missing(method_name, *args, &block)
132
+ @definition.send(method_name, *args, &block)
133
+ end
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,23 @@
1
+ require_relative "expectation-definition"
2
+ require 'cabeza-de-termo/json-spec/instantiators/all-expectations-composite-instantiator'
3
+ require "cabeza-de-termo/json-spec/instantiators/patial-application-instantiator"
4
+
5
+ module CabezaDeTermo
6
+ module JsonSpec
7
+ class ExpectingAllOfExpectationDefinition < ExpectationDefinition
8
+ def initialize(*args)
9
+ super(*args)
10
+
11
+ @expectation_instantiatiors = []
12
+ end
13
+
14
+ def and_also(expectation_method, *args)
15
+ @expectation_instantiatiors << PartialApplicationInstantiator.new(expectation_instantiator_for(expectation_method), args)
16
+ end
17
+
18
+ def expectation_instantiator()
19
+ AllExpectationsCompositeInstantiator.with_all(@expectation_instantiatiors)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require_relative "expectation-definition"
2
+ require 'cabeza-de-termo/json-spec/instantiators/any-expectation-composite-instantiator'
3
+ require "cabeza-de-termo/json-spec/instantiators/patial-application-instantiator"
4
+
5
+ module CabezaDeTermo
6
+ module JsonSpec
7
+ class ExpectingAnyOfExpectationDefinition < ExpectationDefinition
8
+ def initialize(*args)
9
+ super(*args)
10
+
11
+ @expectation_instantiatiors = []
12
+ end
13
+
14
+ def or_also(expectation_method, *args)
15
+ @expectation_instantiatiors << PartialApplicationInstantiator.new(expectation_instantiator_for(expectation_method), args)
16
+ end
17
+
18
+ def expectation_instantiator()
19
+ AnyExpectationCompositeInstantiator.with_all(@expectation_instantiatiors)
20
+ end
21
+ end
22
+ end
23
+ end