chemistrykit 3.8.1 → 3.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +15 -5
  3. data/Gemfile +4 -0
  4. data/README.md +13 -1
  5. data/Rakefile +3 -3
  6. data/chemistrykit.gemspec +7 -3
  7. data/features/brew.feature +1 -1
  8. data/features/chemists.feature +56 -1
  9. data/features/concurrency.feature +2 -2
  10. data/features/exit_status.feature +1 -0
  11. data/features/logging.feature +88 -85
  12. data/features/reporting.feature +105 -0
  13. data/features/step_definitions/steps.rb +4 -4
  14. data/features/support/env.rb +1 -1
  15. data/features/tags.feature +1 -0
  16. data/lib/chemistrykit/chemist.rb +6 -1
  17. data/lib/chemistrykit/chemist/repository/csv_chemist_repository.rb +1 -1
  18. data/lib/chemistrykit/cli/cli.rb +33 -12
  19. data/lib/chemistrykit/configuration.rb +2 -2
  20. data/lib/chemistrykit/formula/formula_lab.rb +13 -0
  21. data/lib/chemistrykit/{parallel_tests_mods.rb → parallel_tests/rspec/runner.rb} +5 -5
  22. data/lib/chemistrykit/reporting/html_report_assembler.rb +170 -0
  23. data/lib/chemistrykit/rspec/html_formatter.rb +241 -0
  24. data/lib/chemistrykit/rspec/j_unit_formatter.rb +124 -0
  25. data/report/config.rb +28 -0
  26. data/report/index.html +213 -0
  27. data/report/javascripts/foundation/foundation.abide.js +194 -0
  28. data/report/javascripts/foundation/foundation.alerts.js +52 -0
  29. data/report/javascripts/foundation/foundation.clearing.js +516 -0
  30. data/report/javascripts/foundation/foundation.cookie.js +74 -0
  31. data/report/javascripts/foundation/foundation.dropdown.js +177 -0
  32. data/report/javascripts/foundation/foundation.forms.js +533 -0
  33. data/report/javascripts/foundation/foundation.interchange.js +280 -0
  34. data/report/javascripts/foundation/foundation.joyride.js +850 -0
  35. data/report/javascripts/foundation/foundation.js +440 -0
  36. data/report/javascripts/foundation/foundation.magellan.js +135 -0
  37. data/report/javascripts/foundation/foundation.orbit.js +412 -0
  38. data/report/javascripts/foundation/foundation.placeholder.js +179 -0
  39. data/report/javascripts/foundation/foundation.reveal.js +330 -0
  40. data/report/javascripts/foundation/foundation.section.js +400 -0
  41. data/report/javascripts/foundation/foundation.tooltips.js +208 -0
  42. data/report/javascripts/foundation/foundation.topbar.js +300 -0
  43. data/report/javascripts/vendor/custom.modernizr.js +4 -0
  44. data/report/javascripts/vendor/jquery.js +9789 -0
  45. data/report/sass/_normalize.scss +402 -0
  46. data/report/sass/_settings.scss +1301 -0
  47. data/report/sass/app.scss +571 -0
  48. data/report/stylesheets/app.css +3636 -0
  49. data/spec/integration/lib/chemistrykit/formula/formula_lab_spec.rb +26 -2
  50. data/spec/integration/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb +18 -0
  51. data/spec/support/evidence/results_0.html +30 -0
  52. data/spec/support/evidence/results_1.html +27 -0
  53. data/spec/unit/lib/chemistrykit/chemist/repository/csv_chemist_repository_spec.rb +15 -2
  54. data/spec/unit/lib/chemistrykit/chemist_spec.rb +17 -1
  55. data/spec/unit/lib/chemistrykit/configuration_spec.rb +2 -2
  56. data/spec/unit/lib/chemistrykit/formula/formula_lab_spec.rb +7 -0
  57. data/spec/unit/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb +22 -0
  58. metadata +94 -13
  59. data/lib/chemistrykit/j_unit.rb +0 -121
@@ -1,121 +0,0 @@
1
- # Encoding: utf-8
2
-
3
- require 'time'
4
- require 'builder'
5
- require 'rspec/core/formatters/base_formatter'
6
-
7
- # An RSpec formatter for generating results in JUnit format
8
- # updated from https://github.com/natritmeyer/yarjuf
9
- class JUnit < RSpec::Core::Formatters::BaseFormatter
10
-
11
- # rspec formatter methods we care about
12
-
13
- def initialize(output)
14
- super output
15
- @test_suite_results = {}
16
- @builder = Builder::XmlMarkup.new indent: 2
17
- end
18
-
19
- def example_passed(example)
20
- add_to_test_suite_results example
21
- end
22
-
23
- def example_failed(example)
24
- add_to_test_suite_results example
25
- end
26
-
27
- def example_pending(example)
28
- add_to_test_suite_results example
29
- end
30
-
31
- def dump_summary(duration, example_count, failure_count, pending_count)
32
- build_results duration, example_count, failure_count, pending_count
33
- output.puts @builder.target!
34
- end
35
-
36
- protected
37
-
38
- def add_to_test_suite_results(example)
39
- suite_name = JUnit.root_group_name_for(example)
40
- @test_suite_results[suite_name] = [] unless @test_suite_results.keys.include? suite_name
41
- @test_suite_results[suite_name] << example
42
- end
43
-
44
- def failure_details_for(example)
45
- exception = example.metadata[:execution_result][:exception]
46
- exception.nil? ? '' : "#{exception.message}\n#{format_backtrace(exception.backtrace, example).join("\n")}"
47
- end
48
-
49
- # utility methods
50
-
51
- def self.count_in_suite_of_type(suite, test_case_result_type)
52
- suite.select { |example| example.metadata[:execution_result][:status] == test_case_result_type }.size
53
- end
54
-
55
- def self.root_group_name_for(example)
56
- group_hierarchy = []
57
- current_example_group = example.metadata[:example_group]
58
- until current_example_group.nil?
59
- group_hierarchy.unshift current_example_group
60
- current_example_group = current_example_group[:example_group]
61
- end
62
- JUnit.slugify group_hierarchy.first[:description]
63
- end
64
-
65
- # methods to build the xml for test suites and individual tests
66
-
67
- def build_results(duration, example_count, failure_count, pending_count)
68
- @builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'
69
- @builder.testsuites errors: 0, failures: failure_count, skipped: pending_count, tests: example_count, time: duration, timestamp: Time.now.iso8601 do
70
- build_all_suites
71
- end
72
- end
73
-
74
- def build_all_suites
75
- @test_suite_results.each do |suite_name, tests|
76
- build_test_suite suite_name, tests
77
- end
78
- end
79
-
80
- def build_test_suite(suite_name, tests)
81
- failure_count = JUnit.count_in_suite_of_type tests, 'failed'
82
- skipped_count = JUnit.count_in_suite_of_type tests, 'pending'
83
-
84
- @builder.testsuite name: suite_name, tests: tests.size, errors: 0, failures: failure_count, skipped: skipped_count do
85
- @builder.properties
86
- build_all_tests tests
87
- end
88
- end
89
-
90
- def build_all_tests(tests)
91
- tests.each do |test|
92
- build_test test
93
- end
94
- end
95
-
96
- def build_test(test)
97
- test_name = JUnit.slugify test.metadata[:full_description]
98
- execution_time = test.metadata[:execution_result][:run_time]
99
- test_status = test.metadata[:execution_result][:status]
100
-
101
- @builder.testcase name: test_name, time: execution_time do
102
- case test_status
103
- when 'pending' then @builder.skipped
104
- when 'failed' then build_failed_test test
105
- end
106
- end
107
- end
108
-
109
- def build_failed_test(test)
110
- failure_message = "failed #{test.metadata[:full_description]}"
111
-
112
- @builder.failure message: failure_message, type: 'failed' do
113
- @builder.cdata! failure_details_for test
114
- end
115
- end
116
-
117
- def self.slugify(string)
118
- string.downcase.strip.gsub(' ', '_').gsub(/[^\w-]/, '')
119
- end
120
-
121
- end