lib/extensions/mspec/mspec/runner/formatters/dotted.rb in rhodes-3.1.1 vs lib/extensions/mspec/mspec/runner/formatters/dotted.rb in rhodes-3.2.0.beta.1
- old
+ new
@@ -12,10 +12,12 @@
if out.nil?
@out = $stdout
else
@out = File.open out, "w"
end
+
+ @current_state = nil
end
# Creates the +TimerAction+ and +TallyAction+ instances and
# registers them. Registers +self+ for the +:exception+,
# +:before+, +:after+, and +:finish+ actions.
@@ -26,12 +28,19 @@
MSpec.register :exception, self
MSpec.register :before, self
MSpec.register :after, self
MSpec.register :finish, self
+ MSpec.register :abort, self
end
+ def abort
+ if @current_state
+ puts " aborting example: #{@current_state.description}"
+ end
+ end
+
# Returns true if any exception is raised while running
# an example. This flag is reset before each example
# is evaluated.
def exception?
@exception
@@ -45,11 +54,12 @@
@failure
end
# Callback for the MSpec :before event. Resets the
# +#exception?+ and +#failure+ flags.
- def before(state = nil)
+ def before(state=nil)
+ @current_state = state
@failure = @exception = false
end
# Callback for the MSpec :exception event. Stores the
# +ExceptionState+ object to generate the list of backtraces
@@ -63,12 +73,14 @@
end
# Callback for the MSpec :after event. Prints an indicator
# for the result of evaluating this example as follows:
# . = No failure or error
- # F = An ExpectationNotMetError was raised
- # E = Any exception other than ExpectationNotMetError
+ # F = An SpecExpectationNotMetError was raised
+ # E = Any exception other than SpecExpectationNotMetError
def after(state = nil)
+ @current_state = nil
+
unless exception?
print "."
else
print failure? ? "F" : "E"
end