From f63feaf017173eaffbf34d63a44845ce8614e78d Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Sat, 14 Jun 2014 13:05:32 -0700 Subject: [PATCH] Do not use ShowExceptions during tests, it confuses things --- .../lib/middleman-core/core_extensions/show_exceptions.rb | 6 ++++-- .../lib/middleman-core/step_definitions/server_steps.rb | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb b/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb index 3f039ca6..a28e6a7f 100644 --- a/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb +++ b/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb @@ -1,14 +1,16 @@ +require 'rack/showexceptions' + # Support rack/showexceptions during development module Middleman::CoreExtensions class ShowExceptions < ::Middleman::Extension def initialize(app, options_hash={}, &block) super - require 'rack/showexceptions' + app.config.define_setting :show_exceptions, true, 'Whether to catch and display exceptions' end def after_configuration - app.use ::Rack::ShowExceptions + app.use ::Rack::ShowExceptions if app.config[:show_exceptions] end end end diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index 4ea87dc8..94905abe 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -41,12 +41,11 @@ Given /^the Server is running$/ do ENV['MM_ROOT'] = root_dir initialize_commands = @initialize_commands || [] + initialize_commands.unshift lambda { config[:show_exceptions] = false } @server_inst = Middleman::Application.server.inst do - app.initialized do - initialize_commands.each do |p| - config_context.instance_exec(&p) - end + initialize_commands.each do |p| + instance_exec(&p) end end