8989 # as the one that triggered the failure.
9090 Kernel.srand config.seed
9191=end
92- RSpec . configure do |config |
93- config . before ( :suite ) do
94- Percy . config . access_token = ENV [ "PERCY_TOKEN" ]
95- # Percy.config.default_widths = [320, 768, 1280] # to test responsiveness
96- end
97-
98- config . before ( :suite ) { Percy ::Capybara . initialize_build }
99- config . after ( :suite ) { Percy ::Capybara . finalize_build }
100- end
10192
10293 class RSpec ::Core ::Formatters ::JsonFormatter
10394 def dump_summary ( summary )
@@ -106,7 +97,7 @@ def dump_summary(summary)
10697 map { |example | example . metadata [ :points ] } .
10798 sum
10899
109- score = summary .
100+ earned_points = summary .
110101 examples .
111102 select { |example | example . execution_result . status == :passed } .
112103 map { |example | example . metadata [ :points ] } .
@@ -118,10 +109,16 @@ def dump_summary(summary)
118109 :failure_count => summary . failure_count ,
119110 :pending_count => summary . pending_count ,
120111 :total_points => total_points ,
121- :score => score ,
112+ :earned_points => earned_points ,
113+ :score => earned_points . to_f / total_points
122114 }
123115
124- @output_hash [ :summary_line ] = "#{ summary . totals_line } , #{ score } /#{ total_points } points"
116+ @output_hash [ :summary_line ] = [
117+ "#{ summary . example_count } tests" ,
118+ "#{ summary . failure_count } failures" ,
119+ "#{ earned_points } /#{ total_points } points" ,
120+ "#{ score } %" ,
121+ ] . join ( ", " )
125122 end
126123
127124 private
0 commit comments