A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jimweirich/rake/commit/336559f28f55bce418e2ebcc0a57548dcbac4025 below:

Refactor ARGV setup into setup_command_line method. · jimweirich/rake@336559f · GitHub

@@ -9,6 +9,13 @@ def setup

9 9

@app.options.rakelib = []

10 10

end

11 11 12 +

def setup_command_line(*options)

13 +

ARGV.clear

14 +

options.each do |option|

15 +

ARGV << option

16 +

end

17 +

end

18 + 12 19

def test_display_tasks

13 20

@app.options.show_tasks = :tasks

14 21

@app.options.show_task_pattern = //

@@ -193,6 +200,7 @@ def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent

193 200

end

194 201 195 202

def test_load_rakefile_not_found

203 +

ARGV.clear

196 204

Dir.chdir @tempdir

197 205

ENV['RAKE_SYSTEM'] = 'not_exist'

198 206

@@ -201,8 +209,11 @@ def test_load_rakefile_not_found

201 209

options.silent = true

202 210

end

203 211 212 + 204 213

ex = assert_raises(RuntimeError) do

205 -

@app.instance_eval do raw_load_rakefile end

214 +

@app.instance_eval do

215 +

raw_load_rakefile

216 +

end

206 217

end

207 218 208 219

assert_match(/no rakefile found/i, ex.message)

@@ -295,8 +306,7 @@ def test_handle_options_should_strip_options_from_argv

295 306

assert !@app.options.trace

296 307 297 308

valid_option = '--trace'

298 -

ARGV.clear

299 -

ARGV << valid_option

309 +

setup_command_line(valid_option)

300 310 301 311

@app.handle_options

302 312

@@ -305,8 +315,7 @@ def test_handle_options_should_strip_options_from_argv

305 315

end

306 316 307 317

def test_handle_options_trace_default_is_stderr

308 -

ARGV.clear

309 -

ARGV << "--trace"

318 +

setup_command_line("--trace")

310 319 311 320

@app.handle_options

312 321

@@ -315,8 +324,7 @@ def test_handle_options_trace_default_is_stderr

315 324

end

316 325 317 326

def test_handle_options_trace_overrides_to_stdout

318 -

ARGV.clear

319 -

ARGV << "--trace=stdout"

327 +

setup_command_line("--trace=stdout")

320 328 321 329

@app.handle_options

322 330

@@ -327,8 +335,7 @@ def test_handle_options_trace_overrides_to_stdout

327 335

def test_handle_options_trace_does_not_eat_following_task_names

328 336

assert !@app.options.trace

329 337 330 -

ARGV.clear

331 -

ARGV << "--trace" << "sometask"

338 +

setup_command_line("--trace", "sometask")

332 339 333 340

@app.handle_options

334 341

assert ARGV.include?("sometask")

@@ -359,8 +366,7 @@ def test_good_run

359 366 360 367

def test_display_task_run

361 368

ran = false

362 -

ARGV.clear

363 -

ARGV << '-f' << '-s' << '--tasks' << '--rakelib=""'

369 +

setup_command_line('-f', '-s', '--tasks', '--rakelib=""')

364 370

@app.last_description = "COMMENT"

365 371

@app.define_task(Rake::Task, "default")

366 372

out, = capture_io { @app.run }

@@ -372,8 +378,7 @@ def test_display_task_run

372 378 373 379

def test_display_prereqs

374 380

ran = false

375 -

ARGV.clear

376 -

ARGV << '-f' << '-s' << '--prereqs' << '--rakelib=""'

381 +

setup_command_line('-f', '-s', '--prereqs', '--rakelib=""')

377 382

@app.last_description = "COMMENT"

378 383

t = @app.define_task(Rake::Task, "default")

379 384

t.enhance([:a, :b])

@@ -389,8 +394,7 @@ def test_display_prereqs

389 394 390 395

def test_bad_run

391 396

@app.intern(Rake::Task, "default").enhance { fail }

392 -

ARGV.clear

393 -

ARGV << '-f' << '-s' << '--rakelib=""'

397 +

setup_command_line('-f', '-s', '--rakelib=""')

394 398

_, err = capture_io {

395 399

assert_raises(SystemExit){ @app.run }

396 400

}

@@ -401,8 +405,7 @@ def test_bad_run

401 405 402 406

def test_bad_run_with_trace

403 407

@app.intern(Rake::Task, "default").enhance { fail }

404 -

ARGV.clear

405 -

ARGV << '-f' << '-s' << '-t'

408 +

setup_command_line('-f', '-s', '-t')

406 409

_, err = capture_io {

407 410

assert_raises(SystemExit) { @app.run }

408 411

}

@@ -413,8 +416,7 @@ def test_bad_run_with_trace

413 416 414 417

def test_bad_run_with_backtrace

415 418

@app.intern(Rake::Task, "default").enhance { fail }

416 -

ARGV.clear

417 -

ARGV << '-f' << '-s' << '--backtrace'

419 +

setup_command_line('-f', '-s', '--backtrace')

418 420

_, err = capture_io {

419 421

assert_raises(SystemExit) {

420 422

@app.run

@@ -431,8 +433,7 @@ def test_bad_run_includes_exception_name

431 433

@app.intern(Rake::Task, "default").enhance {

432 434

raise CustomError, "intentional"

433 435

}

434 -

ARGV.clear

435 -

ARGV << '-f' << '-s'

436 +

setup_command_line('-f', '-s')

436 437

_, err = capture_io {

437 438

assert_raises(SystemExit) {

438 439

@app.run

@@ -445,8 +446,7 @@ def test_rake_error_excludes_exception_name

445 446

@app.intern(Rake::Task, "default").enhance {

446 447

fail "intentional"

447 448

}

448 -

ARGV.clear

449 -

ARGV << '-f' << '-s'

449 +

setup_command_line('-f', '-s')

450 450

_, err = capture_io {

451 451

assert_raises(SystemExit) {

452 452

@app.run

@@ -470,8 +470,7 @@ def test_printing_original_exception_cause

470 470

raise custom_error, "Secondary Error"

471 471

end

472 472

}

473 -

ARGV.clear

474 -

ARGV << '-f' << '-s'

473 +

setup_command_line('-f', '-s')

475 474

_ ,err = capture_io {

476 475

assert_raises(SystemExit) {

477 476

@app.run

@@ -487,8 +486,7 @@ def test_printing_original_exception_cause

487 486 488 487

def test_run_with_bad_options

489 488

@app.intern(Rake::Task, "default").enhance { fail }

490 -

ARGV.clear

491 -

ARGV << '-f' << '-s' << '--xyzzy'

489 +

setup_command_line('-f', '-s', '--xyzzy')

492 490

assert_raises(SystemExit) {

493 491

capture_io { @app.run }

494 492

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4