Ich habe diesen Code Protokollierung für Produktion und Test/Entwicklungsumgebungen zu konfigurieren:Test-Produktion spezifischer Code mit rspec - Sinatra
class ApplicationController < Sinatra::Base
configure :development, :test do
enable :logging
file = File.new("#{settings.root}/../../log/#{settings.environment}.log", 'a+')
file.sync = true
use Rack::CommonLogger, file
end
configure :production do
enable :logging
log_file = File.new("#{settings.root}/../../log/#{settings.environment}.log", 'a+')
STDOUT.reopen(log_file)
STDERR.reopen(log_file)
STDOUT.sync = true
STDERR.sync = true
end
end
Die Frage ist simplecov die besagt, ich bin nicht der Produktionsblock testet wie ich Ich setze meine Umgebung so, dass sie in meiner spec_helper-Datei "getestet" wird.
Gibt es eine Möglichkeit, Test- und Produktionscode mit rspec zu testen?