ruby-changes:58579
From: Nobuyoshi <ko1@a...>
Date: Tue, 5 Nov 2019 17:42:52 +0900 (JST)
Subject: [ruby-changes:58579] dfb3322d27 (master): `DottedFormatter#state` consistency
https://git.ruby-lang.org/ruby.git/commit/?id=dfb3322d27 From dfb3322d27aa05f506818209ab6a10a77221b86d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 5 Nov 2019 15:47:25 +0900 Subject: `DottedFormatter#state` consistency Let the method of `DottedFormatter` subclasses have the same arity. diff --git a/spec/mspec/lib/mspec/runner/formatters/html.rb b/spec/mspec/lib/mspec/runner/formatters/html.rb index fd64cd0..f79c716 100644 --- a/spec/mspec/lib/mspec/runner/formatters/html.rb +++ b/spec/mspec/lib/mspec/runner/formatters/html.rb @@ -50,7 +50,7 @@ EOH https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/html.rb#L50 print %[#{outcome} - #{@count}</a>)</li>\n] end - def after(state) + def after(state = nil) print %[<li class="pass">- #{state.it}</li>\n] unless exception? end diff --git a/spec/mspec/lib/mspec/runner/formatters/method.rb b/spec/mspec/lib/mspec/runner/formatters/method.rb index ff11519..8a46066 100644 --- a/spec/mspec/lib/mspec/runner/formatters/method.rb +++ b/spec/mspec/lib/mspec/runner/formatters/method.rb @@ -60,7 +60,7 @@ class MethodFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/method.rb#L60 # Callback for the MSpec :after event. Sets or adds to # tallies for the example block. - def after(state) + def after(state = nil) h = methods[@key] h[:examples] += tally.counter.examples h[:expectations] += tally.counter.expectations diff --git a/spec/mspec/lib/mspec/runner/formatters/profile.rb b/spec/mspec/lib/mspec/runner/formatters/profile.rb index 498cd4a..6d15a56 100644 --- a/spec/mspec/lib/mspec/runner/formatters/profile.rb +++ b/spec/mspec/lib/mspec/runner/formatters/profile.rb @@ -38,7 +38,7 @@ class ProfileFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/profile.rb#L38 # Callback for the MSpec :after event. Prints a # newline to finish the description string output. - def after(state) + def after(state = nil) @its << [@describe_name, @it_name, Time.now.to_f - @it_time] super end diff --git a/spec/mspec/lib/mspec/runner/formatters/specdoc.rb b/spec/mspec/lib/mspec/runner/formatters/specdoc.rb index 29adde3..06ac770 100644 --- a/spec/mspec/lib/mspec/runner/formatters/specdoc.rb +++ b/spec/mspec/lib/mspec/runner/formatters/specdoc.rb @@ -35,7 +35,7 @@ class SpecdocFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/specdoc.rb#L35 # Callback for the MSpec :after event. Prints a # newline to finish the description string output. - def after(state) + def after(state = nil) print "\n" end end diff --git a/spec/mspec/lib/mspec/runner/formatters/spinner.rb b/spec/mspec/lib/mspec/runner/formatters/spinner.rb index f6f35cc..89791b6 100644 --- a/spec/mspec/lib/mspec/runner/formatters/spinner.rb +++ b/spec/mspec/lib/mspec/runner/formatters/spinner.rb @@ -105,7 +105,7 @@ class SpinnerFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/spinner.rb#L105 end # Callback for the MSpec :after event. Updates the spinner. - def after(state) + def after(state = nil) print progress_line end diff --git a/spec/mspec/lib/mspec/runner/formatters/summary.rb b/spec/mspec/lib/mspec/runner/formatters/summary.rb index 0c92071..2dfa751 100644 --- a/spec/mspec/lib/mspec/runner/formatters/summary.rb +++ b/spec/mspec/lib/mspec/runner/formatters/summary.rb @@ -5,7 +5,7 @@ class SummaryFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/summary.rb#L5 # Callback for the MSpec :after event. Overrides the # callback provided by +DottedFormatter+ and does not # print any output for each example evaluated. - def after(state) + def after(state = nil) # do nothing end end diff --git a/spec/mspec/lib/mspec/runner/formatters/yaml.rb b/spec/mspec/lib/mspec/runner/formatters/yaml.rb index 090a9b1..bb98f79 100644 --- a/spec/mspec/lib/mspec/runner/formatters/yaml.rb +++ b/spec/mspec/lib/mspec/runner/formatters/yaml.rb @@ -16,7 +16,7 @@ class YamlFormatter < DottedFormatter https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/runner/formatters/yaml.rb#L16 @out = @finish end - def after(state) + def after(state = nil) end def finish -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/