Module: Autotest::CucumberMixin
- Included in:
- Cucumber, CucumberRails, CucumberRailsRspec, CucumberRailsRspec2, CucumberRspec, CucumberRspec2
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb
Instance Attribute Summary collapse
-
#features_to_run ⇒ Object
Returns the value of attribute features_to_run.
Class Method Summary collapse
Instance Method Summary collapse
- #all_features_good ⇒ Object
- #created_args(features_to_run, profile) ⇒ Object
- #initialize ⇒ Object
- #make_cucumber_cmd(features_to_run, _dirty_features_filename) ⇒ Object
- #profile(profile_loader) ⇒ Object
- #rerun_all_features ⇒ Object
- #reset_features ⇒ Object
- #run ⇒ Object
- #run_features ⇒ Object
- #wait_for_green ⇒ Object
Instance Attribute Details
#features_to_run ⇒ Object
Returns the value of attribute features_to_run.
13 14 15 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 13 def features_to_run @features_to_run end |
Class Method Details
Instance Method Details
#all_features_good ⇒ Object
47 48 49 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 47 def all_features_good features_to_run == '' end |
#created_args(features_to_run, profile) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 118 def created_args(features_to_run, profile) args = if profile ['--profile', profile] else %w[--format] << (features_to_run == :all ? 'progress' : 'pretty') end # No --color option as some IDEs (Netbeans) don't output them very well ([31m1 failed step[0m) args += %w[--format rerun --out] << dirty_features_filename args << (features_to_run == :all ? '' : features_to_run) # All steps becom undefined during rerun unless the following is run. args << 'features/step_definitions' << 'features/support' unless features_to_run == :all args.join(' ') end |
#initialize ⇒ Object
15 16 17 18 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 15 def initialize super reset_features end |
#make_cucumber_cmd(features_to_run, _dirty_features_filename) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 100 def make_cucumber_cmd(features_to_run, _dirty_features_filename) return '' if features_to_run.empty? profile_loader = Cucumber::Cli::ProfileLoader.new profile = profile(profile_loader) args = created_args(features_to_run, profile) "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{args}" end |
#profile(profile_loader) ⇒ Object
112 113 114 115 116 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 112 def profile(profile_loader) profile ||= 'autotest-all' if profile_loader.profile?('autotest-all') && features_to_run == :all profile ||= 'autotest' if profile_loader.profile?('autotest') profile || nil end |
#rerun_all_features ⇒ Object
60 61 62 63 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 60 def rerun_all_features reset_features run_features end |
#reset_features ⇒ Object
65 66 67 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 65 def reset_features self.features_to_run = :all end |
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 20 def run hook :initialize reset reset_features add_sigint_handler loop do # ^c handler wait_for_green if tainted rerun_all_tests rerun_all_features if all_good else hook :all_good end wait_for_changes # Once tests and features are green, reset features every # time a file is changed to see if anything breaks. reset_features rescue Interrupt break if wants_to_quit reset reset_features end hook :quit end |
#run_features ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 69 def run_features hook :run_features Tempfile.open('autotest-cucumber') do |dirty_features_file| cmd = make_cucumber_cmd(features_to_run, dirty_features_file.path) break if cmd.empty? old_sync = $stdout.sync $stdout.sync = true self.results = [] line = [] begin open("| #{cmd}", 'r') do |f| # rubocop:disable Security/Open until f.eof? c = f.getc || break print(c) line << c next unless c == "\n" results << line.join line.clear end end ensure $stdout.sync = old_sync end self.features_to_run = dirty_features_file.read.strip self.tainted = true unless features_to_run == '' end hook :ran_features end |
#wait_for_green ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/autotest/cucumber_mixin.rb', line 51 def wait_for_green loop do super run_features wait_for_changes unless all_features_good break if all_features_good end end |