Skip to content

Commit

Permalink
test for staging env acceptability
Browse files Browse the repository at this point in the history
  • Loading branch information
NewAlexandria committed Mar 3, 2024
1 parent 1940efc commit aa9a6b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
/test/dummy/tmp/development_secret.txt

.byebug_history

.DS_Store
5 changes: 4 additions & 1 deletion app/controllers/rake_ui/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class ApplicationController < ActionController::Base
# before_action :authorize_pundit
# before_action :authorize!

STAGING_OK = (Rails.env.staging? && RakeUi.configuration.allow_staging)
PROD_OK = RakeUi.configuration.allow_production

private

def authorize_pundit
Expand All @@ -22,7 +25,7 @@ def authorize_pundit
end

def black_hole_production
return if Rails.env.test? || Rails.env.development? || RakeUi.configuration.allow_production
return if Rails.env.test? || Rails.env.development? || STAGING_OK || PROD_OK

raise ActionController::RoutingError, "Not Found"
end
Expand Down
2 changes: 2 additions & 0 deletions lib/rake-ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

module RakeUi
mattr_accessor :allow_production
mattr_accessor :allow_staging
mattr_accessor :policy_engine
mattr_accessor :policy_callback
mattr_accessor :auth_engine
mattr_accessor :auth_callback

self.allow_production = false
self.allow_staging = true
self.policy_engine = nil
self.policy_callback = nil
self.auth_engine = nil
Expand Down

0 comments on commit aa9a6b3

Please sign in to comment.