GitHub PullRequestReviewCommentEvent at 2014-05-14 08:13:05
Repository: rspec-core
Actor: bicarbon8
Payload: {"comment":{"url":"https://api.github.com/repos/rspec/rspec-core/pulls/comments/12625062","id":12625062,"diff_hunk":"@@ -104,12 +109,28 @@ def setup(err, out)\n       # @return [Fixnum] exit status code. 0 if all specs passed,\n       #   or the configured failure exit code (1 by default) if specs\n       #   failed.\n-      def run_specs(example_groups)\n+      def run_specs(example_groups, num_threads=1)\n         @configuration.reporter.report(@world.example_count(example_groups)) do |reporter|\n           begin\n             hook_context = SuiteHookContext.new\n             @configuration.hooks.run(:before, :suite, hook_context)\n-            example_groups.map { |g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code\n+            # example_groups.map { |g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code\n+            group_threads = RSpec::Core::ExampleGroupThreadRunner.new\n+            example_groups.map {|g| \n+              group_threads.run(g, reporter, num_threads)\n+            }\n+\n+            # wait for example_groups to complete\n+            group_threads.wait_for_completion\n+\n+            # get results of testing now that we're done\n+            example_groups.map { |g| \n+              reporter.example_group_started(g)\n+              result_for_this_group = g.succeeded?\n+              results_for_descendants = g.ordering_strategy.order(g.children).map {|child| child.succeeded? }.all?\n+              reporter.example_group_finished(g)\n+              result_for_this_group && results_for_descendants\n+            }.all? ? 0 : @configuration.failure_exit_code","path":"lib/rspec/core/runner.rb","position":66,"original_position":66,"commit_id":"b4959a96db04043bd0f60506c365b7e647a1e285","original_commit_id":"b4959a96db04043bd0f60506c365b7e647a1e285","user":{"login":"bicarbon8","id":2321610,"avatar_url":"https://avatars.githubusercontent.com/u/2321610?","gravatar_id":"589cf17008cb67e1ba5cade726816329","url":"https://api.github.com/users/bicarbon8","html_url":"https://github.com/bicarbon8","followers_url":"https://api.github.com/users/bicarbon8/followers","following_url":"https://api.github.com/users/bicarbon8/following{/other_user}","gists_url":"https://api.github.com/users/bicarbon8/gists{/gist_id}","starred_url":"https://api.github.com/users/bicarbon8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bicarbon8/subscriptions","organizations_url":"https://api.github.com/users/bicarbon8/orgs","repos_url":"https://api.github.com/users/bicarbon8/repos","events_url":"https://api.github.com/users/bicarbon8/events{/privacy}","received_events_url":"https://api.github.com/users/bicarbon8/received_events","type":"User","site_admin":false},"body":"The ternary was a direct copy over from how the results were being collected prior to my changes.  I agree it isn't the best approach, but I believe it to be outside the scope of the changes I've made since it was how this method operated prior. \r\n```ruby\r\n112 example_groups.map { |g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code\r\n```\r\nwhich used the following inside the ExampleGroup.run method\r\n```ruby\r\n456 run_before_context_hooks(new)\r\n457 result_for_this_group = run_examples(reporter)\r\n458 results_for_descendants = ordering_strategy.order(children).map { |child| child.run(reporter) }.all?\r\n459 result_for_this_group && results_for_descendants\r\n```\r\nThat said, its simple enough to change to a standard _if_ block if needed","created_at":"2014-05-14T08:13:05Z","updated_at":"2014-05-14T08:13:05Z","html_url":"https://github.com/rspec/rspec-core/pull/1527#discussion_r12625062","pull_request_url":"https://api.github.com/repos/rspec/rspec-core/pulls/1527","_links":{"self":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/comments/12625062"},"html":{"href":"https://github.com/rspec/rspec-core/pull/1527#discussion_r12625062"},"pull_request":{"href":"https://api.github.com/repos/rspec/rspec-core/pulls/1527"}}}}