Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
1d92b90b
Commit
1d92b90b
authored
7 years ago
by
Yamagishi Kazutoshi
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix force_ssl conditional (#6201)
parent
da809f9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/application_controller.rb
+1
-1
1 addition, 1 deletion
app/controllers/application_controller.rb
spec/controllers/application_controller_spec.rb
+8
-12
8 additions, 12 deletions
spec/controllers/application_controller_spec.rb
spec/rails_helper.rb
+1
-1
1 addition, 1 deletion
spec/rails_helper.rb
with
10 additions
and
14 deletions
app/controllers/application_controller.rb
+
1
−
1
View file @
1d92b90b
...
...
@@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base
private
def
https_enabled?
Rails
.
env
.
production?
&&
ENV
[
'LOCAL_HTTPS'
]
==
'true'
Rails
.
env
.
production?
end
def
store_current_location
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/application_controller_spec.rb
+
8
−
12
View file @
1d92b90b
...
...
@@ -47,22 +47,18 @@ describe ApplicationController, type: :controller do
include_examples
'respond_with_error'
,
422
end
it
"does not force ssl if
LOCAL_HTTPS
is not 'true'"
do
it
"does not force ssl if
Rails.env.production?
is not 'true'"
do
routes
.
draw
{
get
'success'
=>
'anonymous#success'
}
ClimateControl
.
modify
LOCAL_HTTPS
:
''
do
allow
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
true
)
get
'success'
expect
(
response
).
to
have_http_status
(
:success
)
end
allow
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
false
)
get
'success'
expect
(
response
).
to
have_http_status
(
:success
)
end
it
"forces ssl if
LOCAL_HTTPS
is 'true'"
do
it
"forces ssl if
Rails.env.production?
is 'true'"
do
routes
.
draw
{
get
'success'
=>
'anonymous#success'
}
ClimateControl
.
modify
LOCAL_HTTPS
:
'true'
do
allow
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
true
)
get
'success'
expect
(
response
).
to
redirect_to
(
'https://test.host/success'
)
end
allow
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
true
)
get
'success'
expect
(
response
).
to
redirect_to
(
'https://test.host/success'
)
end
describe
'helper_method :current_account'
do
...
...
This diff is collapsed.
Click to expand it.
spec/rails_helper.rb
+
1
−
1
View file @
1d92b90b
...
...
@@ -46,7 +46,7 @@ RSpec.configure do |config|
config
.
include
ActiveSupport
::
Testing
::
TimeHelpers
config
.
before
:each
,
type: :feature
do
https
=
Rails
.
env
.
production?
||
ENV
[
'LOCAL_HTTPS'
]
==
'true'
https
=
ENV
[
'LOCAL_HTTPS'
]
==
'true'
Capybara
.
app_host
=
"http
#{
https
?
's'
:
''
}
://
#{
ENV
.
fetch
(
'LOCAL_DOMAIN'
)
}
"
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment