mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-16 16:16:43 +10:00
Merge branch 'master' into doc_refactor_commits_api
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@ before_script:
|
||||
- touch log/application.log
|
||||
- touch log/test.log
|
||||
- bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
|
||||
- bundle exec rake db:reset db:create RAILS_ENV=test
|
||||
- RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
|
||||
|
||||
spec:feature:
|
||||
script:
|
||||
@@ -118,7 +118,7 @@ flay:
|
||||
- mysql
|
||||
|
||||
bundler:audit:
|
||||
script:
|
||||
script:
|
||||
- "bundle exec bundle-audit update"
|
||||
- "bundle exec bundle-audit check"
|
||||
tags:
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Please view this file on the master branch, on stable branches it's out of date.
|
||||
|
||||
v 8.5.0 (unreleased)
|
||||
|
||||
v 8.4.0 (unreleased)
|
||||
- Ensure Gravatar host looks like an actual host
|
||||
- Add pagination headers to already paginated API resources
|
||||
- Properly generate diff of orphan commits, like the first commit in a repository
|
||||
- Improve the consistency of commit titles, branch names, tag names, issue/MR titles, on their respective project pages
|
||||
@@ -58,10 +61,13 @@ v 8.4.0 (unreleased)
|
||||
- Import GitHub wiki into GitLab
|
||||
- Add reporters ability to download and browse build artifacts (Andrew Johnson)
|
||||
- Autofill referring url in message box when reporting user abuse. (Josh Frye)
|
||||
- Remove leading comma on award emoji when the user is the first to award the emoji (Zeger-Jan van de Weg)
|
||||
- Add build artifacts browser
|
||||
- Improve UX in builds artifacts browser
|
||||
- Increase default size of `data` column in `events` table when using MySQL
|
||||
|
||||
v 8.3.4
|
||||
- Use gitlab-workhorse 0.5.4 (fixes API routing bug)
|
||||
- Add build artifacts browser
|
||||
|
||||
v 8.3.3
|
||||
- Preserve CE behavior with JIRA integration by only calling API if URL is set
|
||||
@@ -109,6 +115,7 @@ v 8.3.0
|
||||
- Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera)
|
||||
- Add rake tasks for git repository maintainance (Zeger-Jan van de Weg)
|
||||
- Fix 500 error when update group member permission
|
||||
- Fix: As an admin, cannot add oneself as a member to a group/project
|
||||
- Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera)
|
||||
- Recognize issue/MR/snippet/commit links as references
|
||||
- Backport JIRA features from EE to CE
|
||||
@@ -170,7 +177,6 @@ v 8.2.2
|
||||
- Fix Error 500 when viewing user's personal projects from admin page (Stan Hu)
|
||||
- Fix: Raw private snippets access workflow
|
||||
- Prevent "413 Request entity too large" errors when pushing large files with LFS
|
||||
- Fix: As an admin, cannot add oneself as a member to a group/project
|
||||
- Fix invalid links within projects dashboard header
|
||||
- Make current user the first user in assignee dropdown in issues detail page (Stan Hu)
|
||||
- Fix: duplicate email notifications on issue comments
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.5.4
|
||||
0.6.0
|
||||
|
||||
@@ -18,7 +18,7 @@ gem "mysql2", '~> 0.3.16', group: :mysql
|
||||
gem "pg", '~> 0.18.2', group: :postgres
|
||||
|
||||
# Authentication libraries
|
||||
gem 'devise', '~> 3.5.3'
|
||||
gem 'devise', '~> 3.5.4'
|
||||
gem 'devise-async', '~> 0.9.0'
|
||||
gem 'doorkeeper', '~> 2.2.0'
|
||||
gem 'omniauth', '~> 1.2.2'
|
||||
|
||||
+5
-5
@@ -157,7 +157,7 @@ GEM
|
||||
activerecord (>= 3.2.0, < 5.0)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
devise (3.5.3)
|
||||
devise (3.5.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
@@ -614,7 +614,7 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
raindrops (0.15.0)
|
||||
rake (10.4.2)
|
||||
rake (10.5.0)
|
||||
raphael-rails (2.1.2)
|
||||
rb-fsevent (0.9.6)
|
||||
rb-inotify (0.9.5)
|
||||
@@ -648,8 +648,8 @@ GEM
|
||||
request_store (1.2.1)
|
||||
rerun (0.11.0)
|
||||
listen (~> 3.0)
|
||||
responders (2.1.0)
|
||||
railties (>= 4.2.0, < 5)
|
||||
responders (2.1.1)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
@@ -911,7 +911,7 @@ DEPENDENCIES
|
||||
d3_rails (~> 3.5.0)
|
||||
database_cleaner (~> 1.4.0)
|
||||
default_value_for (~> 3.0.0)
|
||||
devise (~> 3.5.3)
|
||||
devise (~> 3.5.4)
|
||||
devise-async (~> 0.9.0)
|
||||
devise-two-factor (~> 2.0.0)
|
||||
diffy (~> 3.0.3)
|
||||
|
||||
@@ -19,7 +19,7 @@ class @AwardsHandler
|
||||
@addAwardToEmojiBar(emoji)
|
||||
|
||||
$(".emoji-menu").hide()
|
||||
|
||||
|
||||
addAwardToEmojiBar: (emoji) ->
|
||||
@addEmojiToFrequentlyUsedList(emoji)
|
||||
|
||||
@@ -66,9 +66,14 @@ class @AwardsHandler
|
||||
|
||||
addMeToAuthorList: (emoji) ->
|
||||
award_block = @findEmojiIcon(emoji).parent()
|
||||
authors = award_block.attr("data-original-title").split(", ")
|
||||
authors = _.compact(award_block.attr("data-original-title").split(", "))
|
||||
authors.push("me")
|
||||
award_block.attr("title", authors.join(", "))
|
||||
|
||||
if authors.length == 1
|
||||
award_block.attr("title", "me")
|
||||
else
|
||||
award_block.attr("title", authors.join(", "))
|
||||
|
||||
@resetTooltip(award_block)
|
||||
|
||||
resetTooltip: (award) ->
|
||||
@@ -78,7 +83,7 @@ class @AwardsHandler
|
||||
setTimeout (->
|
||||
award.tooltip()
|
||||
), 200
|
||||
|
||||
|
||||
|
||||
createEmoji: (emoji) ->
|
||||
emojiCssClass = @resolveNameToCssClass(emoji)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.filter-item {
|
||||
margin-right: 15px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
@media (min-width: 800px) {
|
||||
|
||||
@@ -36,6 +36,10 @@ li.commit {
|
||||
line-height: 20px;
|
||||
margin-bottom: 2px;
|
||||
|
||||
.btn-clipboard {
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.notes_count {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
border-bottom: 1px solid #DDD;
|
||||
padding-bottom: 15px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
.term {
|
||||
height: 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,8 @@ class IssuableFinder
|
||||
elsif current_user && params[:authorized_only].presence && !current_user_related?
|
||||
@projects = current_user.authorized_projects.reorder(nil)
|
||||
else
|
||||
@projects = ProjectsFinder.new.execute(current_user).reorder(nil)
|
||||
@projects = ProjectsFinder.new.execute(current_user, group: group).
|
||||
reorder(nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
%tr{ class: 'tree-item' }
|
||||
- path_to_directory = browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path)
|
||||
|
||||
%tr.tree-item{ 'data-link' => path_to_directory}
|
||||
%td.tree-item-file-name
|
||||
= tree_icon('folder', '755', directory.name)
|
||||
%span.str-truncated
|
||||
= link_to directory.name, browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path)
|
||||
= link_to directory.name, path_to_directory
|
||||
%td
|
||||
%td
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
%tr{ class: 'tree-item' }
|
||||
- path_to_file = file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: file.path)
|
||||
|
||||
%tr.tree-item{ 'data-link' => path_to_file }
|
||||
%td.tree-item-file-name
|
||||
= tree_icon('file', '664', file.name)
|
||||
%span.str-truncated
|
||||
= file.name
|
||||
= link_to file.name, path_to_file
|
||||
%td
|
||||
= number_to_human_size(file.metadata[:size], precision: 2)
|
||||
%td
|
||||
= link_to file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: file.path),
|
||||
class: 'btn btn-xs btn-default artifact-download' do
|
||||
= icon('download')
|
||||
= number_to_human_size(file.metadata[:zipped], precision: 2)
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
- page_title 'Artifacts', "#{@build.name} (##{@build.id})", 'Builds'
|
||||
= render 'projects/builds/header_title'
|
||||
|
||||
#tree-holder.tree-holder
|
||||
.gray-content-block.top-block.clearfix
|
||||
.pull-right
|
||||
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build),
|
||||
class: 'btn btn-default' do
|
||||
= icon('download')
|
||||
Download artifacts archive
|
||||
.top-block.gray-content-block.clearfix
|
||||
.pull-right
|
||||
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build),
|
||||
class: 'btn btn-default' do
|
||||
= icon('download')
|
||||
Download artifacts archive
|
||||
|
||||
%div.tree-content-holder
|
||||
.table-holder
|
||||
%table.table.tree-table.table-striped
|
||||
.tree-holder
|
||||
%div.tree-content-holder
|
||||
%table.table.tree-table
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Size
|
||||
%th Download
|
||||
%th Compressed to
|
||||
= render partial: 'tree_directory', collection: @entry.directories(parent: true), as: :directory
|
||||
= render partial: 'tree_file', collection: @entry.files, as: :file
|
||||
|
||||
- if @entry.empty?
|
||||
.center Empty
|
||||
|
||||
:javascript
|
||||
$(document).on('click', 'tr[data-link]', function(e) {
|
||||
window.location = this.dataset.link;
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
%tr
|
||||
%th= t('sherlock.time')
|
||||
%th= t('sherlock.query')
|
||||
%td
|
||||
%th
|
||||
%tbody
|
||||
- @transaction.sorted_queries.each do |query|
|
||||
%tr
|
||||
|
||||
@@ -16,6 +16,9 @@ Rails.application.configure do
|
||||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
||||
|
||||
@@ -9,13 +9,8 @@ class Settings < Settingslogic
|
||||
gitlab.port.to_i == (gitlab.https ? 443 : 80)
|
||||
end
|
||||
|
||||
# get host without www, thanks to http://stackoverflow.com/a/6674363/1233435
|
||||
def get_host_without_www(url)
|
||||
url = CGI.escape(url)
|
||||
uri = URI.parse(url)
|
||||
uri = URI.parse("http://#{url}") if uri.scheme.nil?
|
||||
host = uri.host.downcase
|
||||
host.start_with?('www.') ? host[4..-1] : host
|
||||
def host_without_www(url)
|
||||
host(url).sub('www.', '')
|
||||
end
|
||||
|
||||
def build_gitlab_ci_url
|
||||
@@ -87,6 +82,17 @@ class Settings < Settingslogic
|
||||
custom_port
|
||||
]
|
||||
end
|
||||
|
||||
# Extract the host part of the given +url+.
|
||||
def host(url)
|
||||
url = url.downcase
|
||||
url = "http://#{url}" unless url.start_with?('http')
|
||||
|
||||
# Get rid of the path so that we don't even have to encode it
|
||||
url_without_path = url.sub(%r{(https?://[^\/]+)/?.*}, '\1')
|
||||
|
||||
URI.parse(url_without_path).host
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -228,7 +234,7 @@ Settings['gravatar'] ||= Settingslogic.new({})
|
||||
Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
|
||||
Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon'
|
||||
Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon'
|
||||
Settings.gravatar['host'] = Settings.get_host_without_www(Settings.gravatar['plain_url'])
|
||||
Settings.gravatar['host'] = Settings.host_without_www(Settings.gravatar['plain_url'])
|
||||
|
||||
#
|
||||
# Cron Jobs
|
||||
|
||||
@@ -55,6 +55,12 @@ if Gitlab::Metrics.enabled?
|
||||
|
||||
config.instrument_methods(const) if const.is_a?(Module)
|
||||
end
|
||||
|
||||
Dir[Rails.root.join('app', 'finders', '*.rb')].each do |path|
|
||||
const = File.basename(path, '.rb').camelize.constantize
|
||||
|
||||
config.instrument_instance_methods(const)
|
||||
end
|
||||
end
|
||||
|
||||
GC::Profiler.enable
|
||||
|
||||
@@ -6,5 +6,6 @@ class LimitsToMysql < ActiveRecord::Migration
|
||||
change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647
|
||||
change_column :snippets, :content, :text, limit: 2147483647
|
||||
change_column :notes, :st_diff, :text, limit: 2147483647
|
||||
change_column :events, :data, :text, limit: 2147483647
|
||||
end
|
||||
end
|
||||
|
||||
+47
-1
@@ -151,7 +151,53 @@ When listing resources you can pass the following parameters:
|
||||
- `page` (default: `1`) - page number
|
||||
- `per_page` (default: `20`, max: `100`) - number of items to list per page
|
||||
|
||||
[Link headers](http://www.w3.org/wiki/LinkHeader) are send back with each response. These have `rel` prev/next/first/last and contain the relevant URL. Please use these instead of generating your own URLs.
|
||||
### Pagination Link header
|
||||
|
||||
[Link headers](http://www.w3.org/wiki/LinkHeader) are sent back with each
|
||||
response. They have `rel` set to prev/next/first/last and contain the relevant
|
||||
URL. Please use these links instead of generating your own URLs.
|
||||
|
||||
In the cURL example below, we limit the output to 3 items per page (`per_page=3`)
|
||||
and we request the second page (`page=2`) of [comments](notes.md) of the issue
|
||||
with ID `8` which belongs to the project with ID `8`:
|
||||
|
||||
```bash
|
||||
curl -I -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/8/issues/8/notes?per_page=3&page=2
|
||||
```
|
||||
|
||||
The response will then be:
|
||||
|
||||
```
|
||||
HTTP/1.1 200 OK
|
||||
Cache-Control: no-cache
|
||||
Content-Length: 1103
|
||||
Content-Type: application/json
|
||||
Date: Mon, 18 Jan 2016 09:43:18 GMT
|
||||
Link: <https://gitlab.example.com/api/v3/projects/8/issues/8/notes?page=1&per_page=3>; rel="prev", <https://gitlab.example.com/api/v3/projects/8/issues/8/notes?page=3&per_page=3>; rel="next", <https://gitlab.example.com/api/v3/projects/8/issues/8/notes?page=1&per_page=3>; rel="first", <https://gitlab.example.com/api/v3/projects/8/issues/8/notes?page=3&per_page=3>; rel="last"
|
||||
Status: 200 OK
|
||||
Vary: Origin
|
||||
X-Next-Page: 3
|
||||
X-Page: 2
|
||||
X-Per-Page: 3
|
||||
X-Prev-Page: 1
|
||||
X-Request-Id: 732ad4ee-9870-4866-a199-a9db0cde3c86
|
||||
X-Runtime: 0.108688
|
||||
X-Total: 8
|
||||
X-Total-Pages: 3
|
||||
```
|
||||
|
||||
### Other pagination headers
|
||||
|
||||
Additional pagination headers are also sent back.
|
||||
|
||||
| Header | Description |
|
||||
| ------ | ----------- |
|
||||
| `X-Total` | The total number of items |
|
||||
| `X-Total-Pages` | The total number of pages |
|
||||
| `X-Per-Page` | The number of items per page |
|
||||
| `X-Page` | The index of the current page (starting at 1) |
|
||||
| `X-Next-Page` | The index of the next page |
|
||||
| `X-Prev-Page` | The index of the previous page |
|
||||
|
||||
## id vs iid
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ We do not recommend using MySQL due to various issues. For example, case [(in)se
|
||||
|
||||
# Install the database packages
|
||||
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
||||
|
||||
|
||||
# Ensure you have MySQL version 5.5.14 or later
|
||||
mysql --version
|
||||
|
||||
@@ -31,7 +31,7 @@ We do not recommend using MySQL due to various issues. For example, case [(in)se
|
||||
# Ensure you can use the InnoDB engine which is necessary to support long indexes
|
||||
# If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf`, `/etc/mysql/conf.d/*`) for the setting "innodb = off"
|
||||
mysql> SET storage_engine=INNODB;
|
||||
|
||||
|
||||
# Create the GitLab production database
|
||||
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
|
||||
|
||||
@@ -52,3 +52,25 @@ We do not recommend using MySQL due to various issues. For example, case [(in)se
|
||||
mysql> \q
|
||||
|
||||
# You are done installing the database and can go back to the rest of the installation.
|
||||
|
||||
## MySQL strings limits
|
||||
|
||||
After installation or upgrade, remember to run the `add_limits_mysql` Rake task:
|
||||
|
||||
```
|
||||
bundle exec rake add_limits_mysql
|
||||
```
|
||||
|
||||
The `text` type in MySQL has a different size limit than the `text` type in
|
||||
PostgreSQL. In MySQL `text` columns are limited to ~65kB, whereas in PostgreSQL
|
||||
`text` columns are limited up to ~1GB!
|
||||
|
||||
The `add_limits_mysql` Rake task converts some important `text` columns in the
|
||||
GitLab database to `longtext` columns, which can persist values of up to 4GB
|
||||
(sometimes less if the value contains multibyte characters).
|
||||
|
||||
Details can be found in the [PostgreSQL][postgres-text-type] and
|
||||
[MySQL][mysql-text-types] manuals.
|
||||
|
||||
[postgres-text-type]: http://www.postgresql.org/docs/9.1/static/datatype-character.html
|
||||
[mysql-text-types]: http://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
|
||||
|
||||
@@ -48,7 +48,7 @@ which should already be on your system from GitLab 8.1.
|
||||
```bash
|
||||
cd /home/git/gitlab-workhorse
|
||||
sudo -u git -H git fetch --all
|
||||
sudo -u git -H git checkout 0.5.4
|
||||
sudo -u git -H git checkout 0.6.0
|
||||
sudo -u git -H make
|
||||
```
|
||||
|
||||
|
||||
@@ -14,3 +14,4 @@ Depending on the installation method and your GitLab version, there are multiple
|
||||
## Miscellaneous
|
||||
|
||||
- [MySQL to PostgreSQL](mysql_to_postgresql.md) guides you through migrating your database from MySQL to PostgreSQL.
|
||||
- [MySQL installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md) contains additional information about configuring GitLab to work with a MySQL database.
|
||||
|
||||
@@ -49,5 +49,5 @@ Feature: Project Builds Artifacts
|
||||
And recent build has artifacts metadata available
|
||||
When I visit recent build summary page
|
||||
And I click artifacts browse button
|
||||
And I click download button for a file within build artifacts
|
||||
And I click a link to file within build artifacts
|
||||
Then download of a file extracted from build artifacts should start
|
||||
|
||||
@@ -63,8 +63,8 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
|
||||
end
|
||||
end
|
||||
|
||||
step 'I click download button for a file within build artifacts' do
|
||||
page.within('.tree-table') { first('.artifact-download').click }
|
||||
step 'I click a link to file within build artifacts' do
|
||||
page.within('.tree-table') { find_link('ci_artifacts.txt').click }
|
||||
end
|
||||
|
||||
step 'download of a file extracted from build artifacts should start' do
|
||||
|
||||
@@ -39,7 +39,6 @@ module Gitlab
|
||||
end
|
||||
|
||||
use_db && ActiveRecord::Base.connection.active? &&
|
||||
!ActiveRecord::Migrator.needs_migration? &&
|
||||
ActiveRecord::Base.connection.table_exists?('application_settings')
|
||||
|
||||
rescue ActiveRecord::NoDatabaseError
|
||||
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
require_relative '../../config/initializers/1_settings'
|
||||
|
||||
describe Settings, lib: true do
|
||||
|
||||
describe '#host_without_www' do
|
||||
context 'URL with protocol' do
|
||||
it 'returns the host' do
|
||||
expect(Settings.host_without_www('http://foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('http://www.foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('http://secure.foo.com')).to eq 'secure.foo.com'
|
||||
expect(Settings.host_without_www('http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
|
||||
|
||||
expect(Settings.host_without_www('https://foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('https://www.foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('https://secure.foo.com')).to eq 'secure.foo.com'
|
||||
expect(Settings.host_without_www('https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'secure.gravatar.com'
|
||||
end
|
||||
end
|
||||
|
||||
context 'URL without protocol' do
|
||||
it 'returns the host' do
|
||||
expect(Settings.host_without_www('foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('www.foo.com')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('secure.foo.com')).to eq 'secure.foo.com'
|
||||
expect(Settings.host_without_www('www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
|
||||
end
|
||||
|
||||
context 'URL with user/port' do
|
||||
it 'returns the host' do
|
||||
expect(Settings.host_without_www('bob:pass@foo.com:8080')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('bob:pass@www.foo.com:8080')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
|
||||
expect(Settings.host_without_www('bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
|
||||
|
||||
expect(Settings.host_without_www('http://bob:pass@foo.com:8080')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('http://bob:pass@www.foo.com:8080')).to eq 'foo.com'
|
||||
expect(Settings.host_without_www('http://bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
|
||||
expect(Settings.host_without_www('http://bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user