Add a syntax error and detect it with a test

❮ Back Next ❯

Task

Steps

class LimericksController < ApplicationController

  before_action :authenticate_user!, except: [:index]
  before_action :require_permission, except: [:index, :new, :create]

  def index
    @limericks = Limerick.all.reverse_order
    renxxxxxxder :index
  end

  ...
rails test -v
Running 1 tests in a single process (parallelization threshold is 50)
Run options: -v --seed 61993

# Running:

LimericksControllerTest#test_should_get_index = 0.15 s = E


Error:
LimericksControllerTest#test_should_get_index:
NoMethodError: undefined method `renxxxxxxder' for #<LimericksController:0x0000000000d1d8>

    renxxxxxxder :index
    ^^^^^^^^^^^^
    app/controllers/limericks_controller.rb:8:in `index'
    test/controllers/limericks_controller_test.rb:6:in `block in <class:LimericksControllerTest>'


rails test test/controllers/limericks_controller_test.rb:4


Finished in 0.153665s, 6.5077 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips

❮ Back Next ❯