DEV: suppress puts output while running specs

This commit is contained in:
Arpit Jalan 2017-11-02 15:03:36 +05:30
parent 09cee4c315
commit 4634935fe6
4 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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) }