Skip to content

Commit

Permalink
Rename GoodJob::BaseController to GoodJob::ApplicationController (#…
Browse files Browse the repository at this point in the history
…553)

Co-authored-by: Ben Sheldon [he/him] <bensheldon@gmail.com>
  • Loading branch information
shouichi and bensheldon authored Apr 5, 2022
1 parent ee8e1b4 commit af4aa5b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module GoodJob
class BaseController < ActionController::Base # rubocop:disable Rails/ApplicationController
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

around_action :switch_locale
Expand Down
2 changes: 1 addition & 1 deletion engine/app/controllers/good_job/cron_entries_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module GoodJob
class CronEntriesController < GoodJob::BaseController
class CronEntriesController < GoodJob::ApplicationController
def index
@cron_entries = CronEntry.all
end
Expand Down
2 changes: 1 addition & 1 deletion engine/app/controllers/good_job/executions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module GoodJob
class ExecutionsController < GoodJob::BaseController
class ExecutionsController < GoodJob::ApplicationController
def index
@filter = ExecutionsFilter.new(params)
end
Expand Down
2 changes: 1 addition & 1 deletion engine/app/controllers/good_job/jobs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module GoodJob
class JobsController < GoodJob::BaseController
class JobsController < GoodJob::ApplicationController
rescue_from GoodJob::ActiveJobJob::AdapterNotGoodJobError,
GoodJob::ActiveJobJob::ActionForStateMismatchError,
with: :redirect_on_error
Expand Down
2 changes: 1 addition & 1 deletion engine/app/controllers/good_job/processes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module GoodJob
class ProcessesController < GoodJob::BaseController
class ProcessesController < GoodJob::ApplicationController
def index
@processes = GoodJob::Process.active.order(created_at: :desc) if GoodJob::Process.migrated?
end
Expand Down
21 changes: 21 additions & 0 deletions spec/requests/jobs_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true
require 'rails_helper'

describe "requests to jobs endpoint", type: :request do
before do
allow(GoodJob).to receive(:preserve_job_records).and_return(true)
# When spec type is request, ActiveJob::TestHelper is included. It sets the
# adapter to TestAdapter. We forcibly set the adapter to GJ to create GJ
# records.
ExampleJob.enable_test_adapter(GoodJob::Adapter.new(execution_mode: :inline))
end

it "renders successfully" do
ExampleJob.perform_later
assert_equal 1, GoodJob::Execution.count

get "/good_job/jobs"

assert_response :success
end
end
3 changes: 2 additions & 1 deletion spec/test_app/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Application < Rails::Application

# config.middleware.insert_before Rack::Sendfile, ActionDispatch::DebugLocks
config.log_level = :debug

config.action_controller.include_all_helpers = false
end
end

0 comments on commit af4aa5b

Please sign in to comment.