Skip to content

Commit

Permalink
suppress output to stdout in copy_report_struvcture_spec.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Dec 10, 2018
1 parent fdc154c commit ab4e559
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions spec/tools/copy_reports_structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
let(:source_group) { FactoryGirl.create(:miq_group, :settings => settings) }
let(:destination_group) { FactoryGirl.create(:miq_group, :miq_user_role => role) }

before do
@saved_stdout, @saved_stderr = $stdout, $stderr
$stdout = $stderr = StringIO.new
end

after do
$stdout, $stderr = @saved_stdout, @saved_stderr
end

context "copy reports structure" do
describe ".duplicate_for_group" do
it "copies reports structure from one group to another" do
Expand All @@ -23,7 +32,7 @@
expect(destination_group.settings).to be nil
end

it "does not change reports structure on destination group is source group not found" do
it "does not change reports structure on destination group if source group not found" do
expect(ReportStructure).to receive(:abort)
ReportStructure.duplicate_for_group("Some_Not_existed_Group", source_group.description)
source_group.reload
Expand Down Expand Up @@ -52,7 +61,7 @@
expect(@destination_group2.settings).to be nil
end

it "does not change reports structure on group with destination role is source group not found" do
it "does not change reports structure on group with destination role if source group not found" do
destination_group.update(:settings => settings)
expect(ReportStructure).to receive(:abort)
ReportStructure.duplicate_for_role("Some_Not_existed_Group", role.name)
Expand Down

0 comments on commit ab4e559

Please sign in to comment.