1
私は生産とテスト/開発環境のログを設定するには、このコードを持っている:テスト生産RSpecの持つ固有のコード - シナトラ
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
問題がsimplecovことは、私は「として私は、生産ブロックをテストしていないよ述べています私の環境をspec_helperファイル内の 'テスト'に設定しています。
rspecで 'test'コードと 'production'コードの両方をテストする方法はありますか?