turnip_formatter 0.6.0.pre.beta.2 → 0.6.0.pre.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/Rakefile +3 -2
  4. data/lib/rspec/core/formatters/turnip_formatter.rb +8 -9
  5. data/lib/turnip_formatter/ext/turnip/rspec.rb +6 -5
  6. data/lib/turnip_formatter/{template → renderer/html/assets}/turnip_formatter.css +1 -1
  7. data/lib/turnip_formatter/{template → renderer/html/assets}/turnip_formatter.js +0 -0
  8. data/lib/turnip_formatter/{template → renderer/html/assets}/turnip_formatter.scss +1 -1
  9. data/lib/turnip_formatter/renderer/html/base.rb +4 -4
  10. data/lib/turnip_formatter/renderer/html/index.rb +83 -0
  11. data/lib/turnip_formatter/renderer/html/runtime_error.rb +20 -0
  12. data/lib/turnip_formatter/renderer/html/scenario.rb +20 -0
  13. data/lib/turnip_formatter/renderer/html/statistics_feature.rb +45 -0
  14. data/lib/turnip_formatter/renderer/html/statistics_speed.rb +39 -0
  15. data/lib/turnip_formatter/renderer/html/statistics_tag.rb +53 -0
  16. data/lib/turnip_formatter/renderer/html/views/index.html.erb +94 -0
  17. data/lib/turnip_formatter/renderer/html/views/runtime_error.html.erb +20 -0
  18. data/lib/turnip_formatter/renderer/html/views/scenario.html.erb +23 -0
  19. data/lib/turnip_formatter/renderer/html/views/statistics_feature.html.erb +24 -0
  20. data/lib/turnip_formatter/renderer/html/views/statistics_speed.html.erb +24 -0
  21. data/lib/turnip_formatter/renderer/html/views/statistics_tag.html.erb +24 -0
  22. data/lib/turnip_formatter/renderer/html.rb +84 -0
  23. data/lib/turnip_formatter/resource/scenario/base.rb +80 -0
  24. data/lib/turnip_formatter/resource/scenario/failure.rb +50 -0
  25. data/lib/turnip_formatter/resource/scenario/pass.rb +10 -0
  26. data/lib/turnip_formatter/resource/scenario/pending.rb +42 -0
  27. data/lib/turnip_formatter/version.rb +1 -1
  28. data/lib/turnip_formatter.rb +8 -4
  29. data/test/helper.rb +64 -12
  30. data/test/turnip_formatter/renderer/html/test_index.rb +102 -0
  31. data/test/turnip_formatter/renderer/html/test_runtime_error.rb +40 -0
  32. data/test/turnip_formatter/renderer/html/test_statistics_feature.rb +102 -0
  33. data/test/turnip_formatter/renderer/html/test_statistics_speed.rb +77 -0
  34. data/test/turnip_formatter/renderer/html/test_statistics_tag.rb +112 -0
  35. data/test/turnip_formatter/renderer/html/test_step.rb +27 -0
  36. data/test/turnip_formatter/renderer/test_html.rb +75 -0
  37. data/test/turnip_formatter/resource/scenario/test_failure.rb +39 -0
  38. data/test/turnip_formatter/resource/scenario/test_pass.rb +65 -0
  39. data/test/turnip_formatter/resource/scenario/test_pending.rb +39 -0
  40. data/turnip_formatter.gemspec +1 -1
  41. metadata +45 -57
  42. data/lib/turnip_formatter/printer/index.rb +0 -26
  43. data/lib/turnip_formatter/printer/runtime_error.rb +0 -36
  44. data/lib/turnip_formatter/printer/scenario.rb +0 -22
  45. data/lib/turnip_formatter/printer/tab_feature_statistics.rb +0 -46
  46. data/lib/turnip_formatter/printer/tab_speed_statistics.rb +0 -35
  47. data/lib/turnip_formatter/printer/tab_tag_statistics.rb +0 -76
  48. data/lib/turnip_formatter/printer.rb +0 -29
  49. data/lib/turnip_formatter/scenario/base.rb +0 -99
  50. data/lib/turnip_formatter/scenario/failure.rb +0 -44
  51. data/lib/turnip_formatter/scenario/pass.rb +0 -8
  52. data/lib/turnip_formatter/scenario/pending.rb +0 -40
  53. data/lib/turnip_formatter/step.rb +0 -23
  54. data/lib/turnip_formatter/template/exception.slim +0 -8
  55. data/lib/turnip_formatter/template/index.slim +0 -86
  56. data/lib/turnip_formatter/template/runtime_exception.slim +0 -13
  57. data/lib/turnip_formatter/template/scenario.slim +0 -15
  58. data/lib/turnip_formatter/template/tab_feature_statistics.slim +0 -18
  59. data/lib/turnip_formatter/template/tab_speed_statistics.slim +0 -16
  60. data/lib/turnip_formatter/template/tab_tag_statistics.slim +0 -18
  61. data/spec/turnip_formatter/printer/index_spec.rb +0 -38
  62. data/spec/turnip_formatter/printer/scenario_spec.rb +0 -42
  63. data/spec/turnip_formatter/printer/tab_feature_statistics_spec.rb +0 -80
  64. data/spec/turnip_formatter/printer/tab_speed_statistics_spec.rb +0 -48
  65. data/spec/turnip_formatter/printer/tab_tag_statistics_spec.rb +0 -103
  66. data/spec/turnip_formatter/scenario/base_spec.rb +0 -67
  67. data/spec/turnip_formatter/scenario/failure_spec.rb +0 -55
  68. data/spec/turnip_formatter/scenario/pending_spec.rb +0 -51
  69. data/spec/turnip_formatter/template_spec.rb +0 -119
  70. data/test/sample.feature +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 048fca2032893aaaa891ca94b828d4902e76f240
4
- data.tar.gz: 246f710e24aa823ee0c8072099e69c8a93e2fbcd
3
+ metadata.gz: dbad7611dffef3271dfb7612d409335194aca307
4
+ data.tar.gz: 6a3c40e04c1bd7102d7d650f6a6c75320e6fb44b
5
5
  SHA512:
6
- metadata.gz: da405c93158af4c53894a66d86edf97fc4bb6e78842d38724153b858e1dba9362af4982d2876daa8ddec290abe5ae2fe3c708500dcf593102838824e87c5dcb0
7
- data.tar.gz: c1a0a785ee94f842f6eb5029ec88c3884e03c2a347c741c304564619ab3a8c521cf3c396c7340af555c90e6732e17c424ca4eeba5c705b1abcfd6399b79425cb
6
+ metadata.gz: b14e712926f1e8178f74157da2d1ac9d3f5f4f7780d3c2b98df0454665ae61ef3a823c4c743a619005b25e55040e162bfda220d385af87eef915e79f1fd64b7d
7
+ data.tar.gz: 5d79301f0c1b0565145157a030728919c40ecb98325ecd9ed775f06f1f6fd8ef5e6aa3b333c8f66407cabec675f68e6495582e11ac6f0ff02c8bca74611499ad
data/.travis.yml CHANGED
@@ -21,7 +21,6 @@ rvm:
21
21
  - jruby-9.0.0.0
22
22
 
23
23
  script:
24
- - bundle exec rspec
25
24
  - bundle exec rake test
26
25
 
27
26
  gemfile:
data/Rakefile CHANGED
@@ -5,10 +5,11 @@ require 'rake/testtask'
5
5
 
6
6
  desc 'Compile report CSS file'
7
7
  task :compile do
8
- input = open('lib/turnip_formatter/template/turnip_formatter.scss').read
8
+ dir = 'lib/turnip_formatter/renderer/html/assets'
9
+ input = open("#{dir}/turnip_formatter.scss").read
9
10
  engine = Sass::Engine.new(input, syntax: :scss, style: :compressed)
10
11
 
11
- File.open('lib/turnip_formatter/template/turnip_formatter.css', 'w') do |f|
12
+ File.open("#{dir}/turnip_formatter.css", 'w') do |f|
12
13
  f.write engine.render
13
14
  end
14
15
  end
@@ -2,11 +2,10 @@
2
2
 
3
3
  require 'rspec'
4
4
  require 'rspec/core/formatters/base_formatter'
5
- require 'turnip_formatter/scenario/pass'
6
- require 'turnip_formatter/scenario/failure'
7
- require 'turnip_formatter/scenario/pending'
8
- require 'turnip_formatter/printer/index'
9
- require 'turnip_formatter/printer/scenario'
5
+ require 'turnip_formatter/renderer/html/index'
6
+ require 'turnip_formatter/resource/scenario/pass'
7
+ require 'turnip_formatter/resource/scenario/failure'
8
+ require 'turnip_formatter/resource/scenario/pending'
10
9
 
11
10
  module RSpec
12
11
  module Core
@@ -37,24 +36,24 @@ module RSpec
37
36
  end
38
37
 
39
38
  def example_passed(notification)
40
- scenario = ::TurnipFormatter::Scenario::Pass.new(notification.example)
39
+ scenario = ::TurnipFormatter::Resource::Scenario::Pass.new(notification.example)
41
40
  scenarios << scenario
42
41
  end
43
42
 
44
43
  def example_pending(notification)
45
- scenario = ::TurnipFormatter::Scenario::Pending.new(notification.example)
44
+ scenario = ::TurnipFormatter::Resource::Scenario::Pending.new(notification.example)
46
45
  scenarios << scenario
47
46
  end
48
47
 
49
48
  def example_failed(notification)
50
- scenario = ::TurnipFormatter::Scenario::Failure.new(notification.example)
49
+ scenario = ::TurnipFormatter::Resource::Scenario::Failure.new(notification.example)
51
50
  scenarios << scenario
52
51
  end
53
52
 
54
53
  private
55
54
 
56
55
  def output_html(params)
57
- output.puts ::TurnipFormatter::Printer::Index.print_out(params)
56
+ output.puts ::TurnipFormatter::Renderer::Html::Index.new(params).render
58
57
  end
59
58
  end
60
59
  end
@@ -11,6 +11,8 @@ module Turnip
11
11
  original_run(feature_file)
12
12
 
13
13
  feature = Turnip::Builder.build(feature_file)
14
+ return nil if feature.nil?
15
+
14
16
  example_group = ::RSpec.world.example_groups.last
15
17
 
16
18
  update_metadata(feature, example_group)
@@ -21,15 +23,14 @@ module Turnip
21
23
  # @param [RSpec::Core::ExampleGroup] example_group
22
24
  #
23
25
  def update_metadata(feature, example_group)
24
- background_steps = feature.backgrounds.map(&:steps).flatten
25
26
  examples = example_group.children
26
27
 
27
28
  feature.scenarios.zip(examples).each do |scenario, parent_example|
28
29
  example = parent_example.examples.first
29
- steps = background_steps + scenario.steps
30
- tags = (feature.tag_names + scenario.tag_names).uniq
31
-
32
- example.metadata[:turnip_formatter] = { steps: steps, tags: tags }
30
+ example.metadata[:turnip_formatter] = {
31
+ feature: feature,
32
+ scenario: scenario,
33
+ }
33
34
  end
34
35
  end
35
36
  end