Skip to content

Commit

Permalink
Coemetic
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 9, 2013
1 parent 6130693 commit ce3dfec
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions app/app.rb
Expand Up @@ -50,6 +50,12 @@ def for(a)
end
end

class OpalRSpecFormatter < BasicObject
def method_missing(*args)
Kernel.p args
end
end

class OpalRSpecRunner
def initialize(options={}, configuration=RSpec::configuration, world=RSpec::world)
@options = options
Expand All @@ -63,11 +69,14 @@ def run(err, out)
@configuration.output_stream ||= out

puts "Examples to run: #{@world.example_count}"
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.map {|g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
@configuration.formatter = OpalRSpecFormatter
@configuration.reporter.report(@world.example_count) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.map {|g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
end
end
end

Expand Down

0 comments on commit ce3dfec

Please sign in to comment.