Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress output to stdout and stderr in copy_report_structure_spec.rb #18278

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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