Class: TestBoosters::Rspec::Thread
- Inherits:
-
Object
- Object
- TestBoosters::Rspec::Thread
- Defined in:
- lib/test_boosters/rspec/thread.rb
Instance Attribute Summary collapse
-
#files_from_split_configuration ⇒ Object
readonly
Returns the value of attribute files_from_split_configuration.
-
#leftover_files ⇒ Object
readonly
Returns the value of attribute leftover_files.
Instance Method Summary collapse
- #all_files ⇒ Object
- #display_thread_info ⇒ Object
-
#initialize(files_from_split_configuration, leftover_files) ⇒ Thread
constructor
A new instance of Thread.
- #report_path ⇒ Object
- #rspec_command ⇒ Object
- #rspec_options ⇒ Object
-
#run ⇒ Object
:reek:TooManyStatements { max_statements: 10 }.
- #run_rspec ⇒ Object
- #upload_report ⇒ Object
Constructor Details
#initialize(files_from_split_configuration, leftover_files) ⇒ Thread
Returns a new instance of Thread.
8 9 10 11 |
# File 'lib/test_boosters/rspec/thread.rb', line 8 def initialize(files_from_split_configuration, leftover_files) @files_from_split_configuration = files_from_split_configuration @leftover_files = leftover_files end |
Instance Attribute Details
#files_from_split_configuration ⇒ Object (readonly)
Returns the value of attribute files_from_split_configuration.
5 6 7 |
# File 'lib/test_boosters/rspec/thread.rb', line 5 def files_from_split_configuration @files_from_split_configuration end |
#leftover_files ⇒ Object (readonly)
Returns the value of attribute leftover_files.
6 7 8 |
# File 'lib/test_boosters/rspec/thread.rb', line 6 def leftover_files @leftover_files end |
Instance Method Details
#all_files ⇒ Object
51 52 53 |
# File 'lib/test_boosters/rspec/thread.rb', line 51 def all_files @all_files ||= files_from_split_configuration + leftover_files end |
#display_thread_info ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/test_boosters/rspec/thread.rb', line 30 def display_thread_info TestBoosters::Shell.display_files( "Known specs for this thread", files_from_split_configuration) TestBoosters::Shell.display_files( "Leftover specs for this thread", leftover_files) puts "RSpec options: #{}" end |
#report_path ⇒ Object
63 64 65 |
# File 'lib/test_boosters/rspec/thread.rb', line 63 def report_path @report_path ||= ENV["REPORT_PATH"] || "#{ENV["HOME"]}/rspec_report.json" end |
#rspec_command ⇒ Object
59 60 61 |
# File 'lib/test_boosters/rspec/thread.rb', line 59 def rspec_command "bundle exec rspec #{} #{all_files.join(" ")}" end |
#rspec_options ⇒ Object
55 56 57 |
# File 'lib/test_boosters/rspec/thread.rb', line 55 def "#{ENV["TB_RSPEC_OPTIONS"]} --format documentation --format json --out #{report_path}" end |
#run ⇒ Object
:reek:TooManyStatements { max_statements: 10 }
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/test_boosters/rspec/thread.rb', line 14 def run if all_files.empty? puts("No files to run in this thread!") return 0 end display_thread_info exit_status = run_rspec upload_report exit_status end |
#run_rspec ⇒ Object
42 43 44 45 |
# File 'lib/test_boosters/rspec/thread.rb', line 42 def run_rspec TestBoosters::Shell.display_title("Running RSpec") TestBoosters::Shell.execute(rspec_command) end |
#upload_report ⇒ Object
47 48 49 |
# File 'lib/test_boosters/rspec/thread.rb', line 47 def upload_report TestBoosters::InsightsUploader.upload("rspec", report_path) end |