Module: Polytrix::RSpec
- Defined in:
- lib/polytrix/rspec.rb,
lib/polytrix/rspec/yaml_report.rb,
lib/polytrix/rspec/documentation_formatter.rb
Defined Under Namespace
Classes: DocumentationFormatter, YAMLReport
Class Method Summary collapse
- .run_manifest(manifest) ⇒ Object
-
.shared_examples(caller) ⇒ Object
rubocop:disable MethodLength.
Class Method Details
.run_manifest(manifest) ⇒ Object
51 52 53 |
# File 'lib/polytrix/rspec.rb', line 51 def run_manifest(manifest) shared_examples(self) end |
.shared_examples(caller) ⇒ Object
rubocop:disable MethodLength
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/polytrix/rspec.rb', line 13 def shared_examples(caller) # rubocop:disable MethodLength # FIXME: Long method because it's hard to eval in the right context caller.instance_eval do Polytrix.manifest.suites.each do |suite_name, suite_config| describe suite_name do samples = suite_config.samples || [] samples.each do |scenario| describe scenario.name do Polytrix.implementors.each do |sdk| it sdk.name, sdk.name.to_sym => true do | example | begin skip "#{sdk.name} is not setup" unless File.directory? sdk.basedir slug = Polytrix::Challenge.slugify(suite_name, scenario.name, sdk.name) challenge = Polytrix.manifest.challenges[slug] # sdk.build_challenge suite: suite_name, name: scenario, vars: suite_config.env example.[:polytrix_challenge] = challenge challenge.exec validators = Polytrix::ValidatorRegistry.validators_for challenge validators.each do |validator| instance_exec challenge, &validator.callback end rescue Polytrix::FeatureNotImplementedError => e skip e. rescue ThreadError => e # Extra debug info for ThreadError $stderr.puts "ThreadError detected: #{e.}" $stderr.puts "ThreadError backtrace: #{e.backtrace}" fail e end end end end end end end end end |