From 4634935fe6e4bf7d91df8709e2ed87e2d5fd9ad5 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 2 Nov 2017 15:03:36 +0530 Subject: [PATCH] DEV: suppress puts output while running specs --- spec/import_export/category_exporter_spec.rb | 4 ++++ spec/import_export/category_structure_exporter_spec.rb | 4 ++++ spec/import_export/importer_spec.rb | 4 ++++ spec/import_export/topic_exporter_spec.rb | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/spec/import_export/category_exporter_spec.rb b/spec/import_export/category_exporter_spec.rb index 5a6420712e5..3c226175709 100644 --- a/spec/import_export/category_exporter_spec.rb +++ b/spec/import_export/category_exporter_spec.rb @@ -7,6 +7,10 @@ describe ImportExport::CategoryExporter do let(:group) { Fabricate(:group) } let(:user) { Fabricate(:user) } + before do + STDOUT.stubs(:write) + end + context '.perform' do it 'raises an error when the category is not found' do expect { ImportExport::CategoryExporter.new(100).perform }.to raise_error(ActiveRecord::RecordNotFound) diff --git a/spec/import_export/category_structure_exporter_spec.rb b/spec/import_export/category_structure_exporter_spec.rb index a840bf940cc..cb46123d07c 100644 --- a/spec/import_export/category_structure_exporter_spec.rb +++ b/spec/import_export/category_structure_exporter_spec.rb @@ -3,6 +3,10 @@ require "import_export/category_structure_exporter" describe ImportExport::CategoryStructureExporter do + before do + STDOUT.stubs(:write) + end + it 'export all the categories' do category = Fabricate(:category) data = ImportExport::CategoryStructureExporter.new.perform.export_data diff --git a/spec/import_export/importer_spec.rb b/spec/import_export/importer_spec.rb index 3d5146b3ed9..ae212046d2a 100644 --- a/spec/import_export/importer_spec.rb +++ b/spec/import_export/importer_spec.rb @@ -5,6 +5,10 @@ require "import_export/importer" describe ImportExport::Importer do + before do + STDOUT.stubs(:write) + end + let(:import_data) do import_file = Rack::Test::UploadedFile.new(file_from_fixtures("import-export.json", "json")) data = ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(import_file.read)) diff --git a/spec/import_export/topic_exporter_spec.rb b/spec/import_export/topic_exporter_spec.rb index 47a76f02bd6..db767e4da58 100644 --- a/spec/import_export/topic_exporter_spec.rb +++ b/spec/import_export/topic_exporter_spec.rb @@ -3,6 +3,10 @@ require "import_export/topic_exporter" describe ImportExport::TopicExporter do + before do + STDOUT.stubs(:write) + end + let(:user) { Fabricate(:user) } let(:topic) { Fabricate(:topic, user: user) }