BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
60797a42
Commit
60797a42
authored
Jul 27, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Gitlab::Application.routes.default_url_options are set correctly in Capybara + :js specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
48c51e20
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
15 deletions
+13
-15
1_settings.rb
config/initializers/1_settings.rb
+1
-1
related_resources_helpers.rb
lib/api/helpers/related_resources_helpers.rb
+1
-1
issues_spec.rb
spec/features/dashboard/issues_spec.rb
+1
-11
project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+1
-1
spec_helper.rb
spec/spec_helper.rb
+1
-0
capybara.rb
spec/support/capybara.rb
+8
-1
No files found.
config/initializers/1_settings.rb
View file @
60797a42
...
...
@@ -223,7 +223,7 @@ Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_c
Settings
.
gitlab
[
'host'
]
||=
ENV
[
'GITLAB_HOST'
]
||
'localhost'
Settings
.
gitlab
[
'ssh_host'
]
||=
Settings
.
gitlab
.
host
Settings
.
gitlab
[
'https'
]
=
false
if
Settings
.
gitlab
[
'https'
].
nil?
Settings
.
gitlab
[
'port'
]
||=
Settings
.
gitlab
.
https
?
443
:
80
Settings
.
gitlab
[
'port'
]
||=
ENV
[
'GITLAB_PORT'
]
||
(
Settings
.
gitlab
.
https
?
443
:
80
)
Settings
.
gitlab
[
'relative_url_root'
]
||=
ENV
[
'RAILS_RELATIVE_URL_ROOT'
]
||
''
Settings
.
gitlab
[
'protocol'
]
||=
Settings
.
gitlab
.
https
?
"https"
:
"http"
Settings
.
gitlab
[
'email_enabled'
]
||=
true
if
Settings
.
gitlab
[
'email_enabled'
].
nil?
...
...
lib/api/helpers/related_resources_helpers.rb
View file @
60797a42
...
...
@@ -12,7 +12,7 @@ module API
end
def
expose_url
(
path
)
url_options
=
Rails
.
a
pplication
.
routes
.
default_url_options
url_options
=
Gitlab
::
A
pplication
.
routes
.
default_url_options
protocol
,
host
,
port
=
url_options
.
slice
(
:protocol
,
:host
,
:port
).
values
URI
::
HTTP
.
build
(
scheme:
protocol
,
host:
host
,
port:
port
,
path:
path
).
to_s
...
...
spec/features/dashboard/issues_spec.rb
View file @
60797a42
...
...
@@ -79,15 +79,7 @@ RSpec.describe 'Dashboard Issues' do
end
end
it
'shows the new issue page'
,
js:
true
do
original_defaults
=
Gitlab
::
Application
.
routes
.
default_url_options
Gitlab
::
Application
.
routes
.
default_url_options
=
{
host:
Capybara
.
current_session
.
server
.
host
,
port:
Capybara
.
current_session
.
server
.
port
,
protocol:
'http'
}
it
'shows the new issue page'
,
:js
do
find
(
'.new-project-item-select-button'
).
trigger
(
'click'
)
wait_for_requests
find
(
'.select2-results li'
).
click
...
...
@@ -97,8 +89,6 @@ RSpec.describe 'Dashboard Issues' do
page
.
within
(
'#content-body'
)
do
expect
(
page
).
to
have_selector
(
'.issue-form'
)
end
Gitlab
::
Application
.
routes
.
default_url_options
=
original_defaults
end
end
end
spec/models/project_wiki_spec.rb
View file @
60797a42
...
...
@@ -21,7 +21,7 @@ describe ProjectWiki do
describe
'#web_url'
do
it
'returns the full web URL to the wiki'
do
expect
(
subject
.
web_url
).
to
match
(
"https?://[^
\/
]+
/
#{
project
.
path_with_namespace
}
/wikis/home"
)
expect
(
subject
.
web_url
).
to
eq
(
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
path_with_namespace
}
/wikis/home"
)
end
end
...
...
spec/spec_helper.rb
View file @
60797a42
...
...
@@ -59,6 +59,7 @@ RSpec.configure do |config|
config
.
include
Gitlab
::
Routing
,
type: :routing
config
.
include
MigrationsHelpers
,
:migration
config
.
include
StubFeatureFlags
config
.
include
StubENV
config
.
infer_spec_type_from_file_location!
...
...
spec/support/capybara.rb
View file @
60797a42
...
...
@@ -36,7 +36,14 @@ RSpec.configure do |config|
$capybara_server_already_started
=
true
end
config
.
after
(
:each
,
:js
)
do
|
example
|
config
.
before
(
:example
,
:js
)
do
allow
(
Gitlab
::
Application
.
routes
).
to
receive
(
:default_url_options
).
and_return
(
host:
Capybara
.
current_session
.
server
.
host
,
port:
Capybara
.
current_session
.
server
.
port
,
protocol:
'http'
)
end
config
.
after
(
:example
,
:js
)
do
|
example
|
# capybara/rspec already calls Capybara.reset_sessions! in an `after` hook,
# but `block_and_wait_for_requests_complete` is called before it so by
# calling it explicitely here, we prevent any new requests from being fired
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment