Skip to content

Commit

Permalink
added 'after' block to restore otiginal stderror and stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Dec 10, 2018
1 parent fa5255a commit d4bb1d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/tools/copy_reports_structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
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 @@ -27,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 @@ -56,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 d4bb1d7

Please sign in to comment.