Class: TestLauncher::Frameworks::RSpec::Runner

Inherits:
Base::Runner
  • Object
show all
Defined in:
lib/test_launcher/frameworks/rspec.rb

Instance Method Summary collapse

Methods inherited from Base::Runner

#multiple_examples, #multiple_files, #single_file

Instance Method Details

#by_line_number(test_case) ⇒ Object



53
54
55
# File 'lib/test_launcher/frameworks/rspec.rb', line 53

def (test_case)
  %{cd #{test_case.app_root} && bundle exec rspec #{test_case.file}:#{test_case.line_number}}
end

#multiple_examples_same_file(test_cases) ⇒ Object



61
62
63
64
# File 'lib/test_launcher/frameworks/rspec.rb', line 61

def multiple_examples_same_file(test_cases)
  test_case = test_cases.first
  single_example(test_case)
end

#multiple_examples_same_root(test_cases) ⇒ Object



66
67
68
# File 'lib/test_launcher/frameworks/rspec.rb', line 66

def multiple_examples_same_root(test_cases)
  %{cd #{test_cases.first.app_root} && bundle exec rspec #{test_cases.map(&:file).join(" ")} --example #{Shellwords.escape(test_cases.first.example)}}
end

#one_or_more_files(test_cases) ⇒ Object



70
71
72
# File 'lib/test_launcher/frameworks/rspec.rb', line 70

def one_or_more_files(test_cases)
  %{cd #{test_cases.first.app_root} && bundle exec rspec #{test_cases.map(&:file).join(" ")}}
end

#single_example(test_case, **_) ⇒ Object



57
58
59
# File 'lib/test_launcher/frameworks/rspec.rb', line 57

def single_example(test_case, **_)
  multiple_examples_same_root([test_case])
end