Skip to content

Commit 3d48062

Browse files
committed
test for staging env acceptability
1 parent 216cef0 commit 3d48062

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
/test/dummy/tmp/development_secret.txt
1313

1414
.byebug_history
15+
16+
.DS_Store

app/controllers/rake_ui/application_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ module RakeUi
44
class ApplicationController < ActionController::Base
55
before_action :black_hole_production
66

7+
STAGING_OK = (Rails.env.staging? && RakeUi.configuration.allow_staging)
8+
PROD_OK = RakeUi.configuration.allow_production
9+
710
private
811

912
def black_hole_production
10-
return if Rails.env.test? || Rails.env.development? || RakeUi.configuration.allow_production
13+
return if Rails.env.test? || Rails.env.development? || STAGING_OK || PROD_OK
1114

1215
raise ActionController::RoutingError, "Not Found"
1316
end

lib/rake-ui.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
module RakeUi
66
mattr_accessor :allow_production
7+
mattr_accessor :allow_staging
8+
79
self.allow_production = false
10+
self.allow_staging = true
811

912
def self.configuration
1013
yield(self) if block_given?

0 commit comments

Comments
 (0)