-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
217 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--format documentation | ||
--require spec_helper |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
class RspecRunner | ||
def initialize(tmp_dir) | ||
@stdout = StringIO.new | ||
@stderr = StringIO.new | ||
@tmp_dir = tmp_dir | ||
end | ||
|
||
def run(spec) | ||
setup(spec) | ||
|
||
Dir.chdir(tmp_dir) do | ||
RSpec::Core::Runner.run([spec_file, *args], @stdout, @stderr) | ||
end | ||
ensure | ||
write_file("#{tmp_dir}/rspec_output.txt", all_output) | ||
end | ||
|
||
private | ||
|
||
attr_reader :tmp_dir | ||
|
||
def all_output | ||
[@stdout.string, @stderr.string].reject(&:empty?).join("\n") | ||
end | ||
|
||
def setup(spec) | ||
FileUtils.rm_rf(tmp_dir) | ||
|
||
write_file("#{tmp_dir}/#{spec_file}", spec) | ||
end | ||
|
||
def write_file(path, content) | ||
FileUtils.mkdir_p(File.dirname(path)) | ||
File.open(path, "w") { |file| file.write(content) } | ||
end | ||
|
||
def spec_file | ||
"spec/test_spec.rb" | ||
end | ||
|
||
def args | ||
%w[ | ||
--no-color | ||
--format documentation | ||
--format AllureRspecFormatter | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
allure-rspec/spec/unit/formatter_example_group_finished_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
allure-rspec/spec/unit/formatter_example_group_started_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.