Method: Frontline::Controllers#post_run_specs

Defined in:
lib/frontline/controllers/controllers.rb

#post_run_specsObject

run specs for given controllers or for all if no controllers given and stream results to browser.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/frontline/controllers/controllers.rb', line 45

def post_run_specs
  @uuid = params[:uuid]
  controllers = (c = params[:controller]) ? [c] : controllers().keys
  stream do
    failed = false
    pty_stream 'modal', 'show'

    controllers.each do |controller|
      cmd = 'bundle exec rake test:' << controller
      passed, failure_id = pty_spawn(cmd)
      unless passed
        failed = true
        pty_stream 'failures', failure_id
      end
    end
    pty_stream 'modal', 'hide' unless failed
  end
end