Sha256: 419559bd522c9351415383a2d53e04c9da53a9d076771124c95dfa7f259992fa

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

module RSpec
  module ExampleSteps
    module Reporter
      def process_example_step(example, type, message, options)
        example_step_started(self, type, message, options)

        if block_given? && !options[:pending]
          begin
            yield
          rescue Exception => e
            example_step_failed(self, type, message, options)
            raise e
          end
          example_step_passed(self, type, message, options)
        else
          example_step_pending(self, type, message, options)
        end
      end

      def example_step_started(example, type, message, options)
        notify :example_step_started, Notification.new(example, type, message, options)
      end

      def example_step_passed(example, type, message, options)
        notify :example_step_passed, Notification.new(example, type, message, options)
      end

      def example_step_pending(example, type, message, options)
        notify :example_step_pending, Notification.new(example, type, message, options)
      end

      def example_step_failed(example, type, message, options)
        notify :example_step_failed, Notification.new(example, type, message, options)
      end

      def registered_formatters
        @listeners.values.map(&:to_a).flatten.uniq
      end

      def find_registered_formatter(klass)
        registered_formatters.detect { |formatter| formatter.class == klass }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-example_steps-3.1.1 lib/rspec/example_steps/reporter.rb
rspec-example_steps-3.1.0 lib/rspec/example_steps/reporter.rb
rspec-example_steps-3.0.2 lib/rspec/example_steps/reporter.rb
rspec-example_steps-3.0.1 lib/rspec/example_steps/reporter.rb
rspec-example_steps-3.0.0 lib/rspec/example_steps/reporter.rb