Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
fcb37542
Commit
fcb37542
authored
Jan 26, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `:empty_project` where possible in model specs
parent
f27721e8
Changes
66
Hide whitespace changes
Inline
Side-by-side
Showing
66 changed files
with
148 additions
and
146 deletions
+148
-146
spec/models/ability_spec.rb
spec/models/ability_spec.rb
+5
-5
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+4
-4
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+3
-4
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+1
-1
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+7
-7
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+1
-1
spec/models/compare_spec.rb
spec/models/compare_spec.rb
+1
-1
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+3
-3
spec/models/concerns/mentionable_spec.rb
spec/models/concerns/mentionable_spec.rb
+4
-4
spec/models/concerns/milestoneish_spec.rb
spec/models/concerns/milestoneish_spec.rb
+1
-1
spec/models/concerns/project_features_compatibility_spec.rb
spec/models/concerns/project_features_compatibility_spec.rb
+1
-1
spec/models/cycle_analytics/code_spec.rb
spec/models/cycle_analytics/code_spec.rb
+1
-1
spec/models/cycle_analytics/issue_spec.rb
spec/models/cycle_analytics/issue_spec.rb
+1
-1
spec/models/cycle_analytics/plan_spec.rb
spec/models/cycle_analytics/plan_spec.rb
+1
-1
spec/models/cycle_analytics/production_spec.rb
spec/models/cycle_analytics/production_spec.rb
+1
-1
spec/models/cycle_analytics/review_spec.rb
spec/models/cycle_analytics/review_spec.rb
+1
-1
spec/models/cycle_analytics/staging_spec.rb
spec/models/cycle_analytics/staging_spec.rb
+2
-1
spec/models/cycle_analytics/test_spec.rb
spec/models/cycle_analytics/test_spec.rb
+1
-1
spec/models/deploy_keys_project_spec.rb
spec/models/deploy_keys_project_spec.rb
+2
-2
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+1
-1
spec/models/diff_note_spec.rb
spec/models/diff_note_spec.rb
+2
-2
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+2
-2
spec/models/event_spec.rb
spec/models/event_spec.rb
+3
-3
spec/models/forked_project_link_spec.rb
spec/models/forked_project_link_spec.rb
+2
-2
spec/models/global_milestone_spec.rb
spec/models/global_milestone_spec.rb
+3
-3
spec/models/group_milestone_spec.rb
spec/models/group_milestone_spec.rb
+1
-1
spec/models/guest_spec.rb
spec/models/guest_spec.rb
+3
-3
spec/models/hooks/system_hook_spec.rb
spec/models/hooks/system_hook_spec.rb
+1
-1
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+1
-1
spec/models/issue/metrics_spec.rb
spec/models/issue/metrics_spec.rb
+1
-1
spec/models/issue_collection_spec.rb
spec/models/issue_collection_spec.rb
+1
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+9
-9
spec/models/member_spec.rb
spec/models/member_spec.rb
+1
-1
spec/models/members/project_member_spec.rb
spec/models/members/project_member_spec.rb
+4
-4
spec/models/merge_request/metrics_spec.rb
spec/models/merge_request/metrics_spec.rb
+1
-3
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+3
-3
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+2
-2
spec/models/network/graph_spec.rb
spec/models/network/graph_spec.rb
+1
-1
spec/models/note_spec.rb
spec/models/note_spec.rb
+6
-6
spec/models/project_feature_spec.rb
spec/models/project_feature_spec.rb
+2
-2
spec/models/project_group_link_spec.rb
spec/models/project_group_link_spec.rb
+1
-1
spec/models/project_label_spec.rb
spec/models/project_label_spec.rb
+1
-1
spec/models/project_services/asana_service_spec.rb
spec/models/project_services/asana_service_spec.rb
+1
-1
spec/models/project_services/assembla_service_spec.rb
spec/models/project_services/assembla_service_spec.rb
+1
-1
spec/models/project_services/campfire_service_spec.rb
spec/models/project_services/campfire_service_spec.rb
+1
-1
spec/models/project_services/drone_ci_service_spec.rb
spec/models/project_services/drone_ci_service_spec.rb
+1
-1
spec/models/project_services/external_wiki_service_spec.rb
spec/models/project_services/external_wiki_service_spec.rb
+1
-1
spec/models/project_services/flowdock_service_spec.rb
spec/models/project_services/flowdock_service_spec.rb
+1
-1
spec/models/project_services/gemnasium_service_spec.rb
spec/models/project_services/gemnasium_service_spec.rb
+1
-1
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
...els/project_services/gitlab_issue_tracker_service_spec.rb
+3
-3
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+3
-3
spec/models/project_services/irker_service_spec.rb
spec/models/project_services/irker_service_spec.rb
+1
-1
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+6
-6
spec/models/project_services/pipeline_email_service_spec.rb
spec/models/project_services/pipeline_email_service_spec.rb
+1
-1
spec/models/project_services/pushover_service_spec.rb
spec/models/project_services/pushover_service_spec.rb
+1
-1
spec/models/project_team_spec.rb
spec/models/project_team_spec.rb
+5
-5
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+1
-1
spec/models/service_spec.rb
spec/models/service_spec.rb
+8
-8
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+3
-3
spec/models/todo_spec.rb
spec/models/todo_spec.rb
+6
-2
spec/models/tree_spec.rb
spec/models/tree_spec.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+3
-3
spec/support/cycle_analytics_helpers/test_generation.rb
spec/support/cycle_analytics_helpers/test_generation.rb
+1
-1
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+1
-1
spec/support/slack_mattermost_notifications_shared_examples.rb
...support/slack_mattermost_notifications_shared_examples.rb
+3
-3
No files found.
spec/models/ability_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Ability
,
lib:
true
do
describe
Ability
,
lib:
true
do
describe
'.can_edit_note?'
do
describe
'.can_edit_note?'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
!
(
:note
)
{
create
(
:note_on_issue
,
project:
project
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
project:
project
)
}
context
'using an anonymous user'
do
context
'using an anonymous user'
do
it
'returns false'
do
it
'returns false'
do
...
@@ -60,7 +60,7 @@ describe Ability, lib: true do
...
@@ -60,7 +60,7 @@ describe Ability, lib: true do
describe
'.users_that_can_read_project'
do
describe
'.users_that_can_read_project'
do
context
'using a public project'
do
context
'using a public project'
do
it
'returns all the users'
do
it
'returns all the users'
do
project
=
create
(
:project
,
:public
)
project
=
create
(
:
empty_
project
,
:public
)
user
=
build
(
:user
)
user
=
build
(
:user
)
expect
(
described_class
.
users_that_can_read_project
([
user
],
project
)).
expect
(
described_class
.
users_that_can_read_project
([
user
],
project
)).
...
@@ -69,7 +69,7 @@ describe Ability, lib: true do
...
@@ -69,7 +69,7 @@ describe Ability, lib: true do
end
end
context
'using an internal project'
do
context
'using an internal project'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:internal
)
}
it
'returns users that are administrators'
do
it
'returns users that are administrators'
do
user
=
build
(
:user
,
admin:
true
)
user
=
build
(
:user
,
admin:
true
)
...
@@ -120,7 +120,7 @@ describe Ability, lib: true do
...
@@ -120,7 +120,7 @@ describe Ability, lib: true do
end
end
context
'using a private project'
do
context
'using a private project'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:private
)
}
it
'returns users that are administrators'
do
it
'returns users that are administrators'
do
user
=
build
(
:user
,
admin:
true
)
user
=
build
(
:user
,
admin:
true
)
...
@@ -247,7 +247,7 @@ describe Ability, lib: true do
...
@@ -247,7 +247,7 @@ describe Ability, lib: true do
end
end
describe
'.project_disabled_features_rules'
do
describe
'.project_disabled_features_rules'
do
let
(
:project
)
{
create
(
:
project
,
wiki_access_level:
ProjectFeature
::
DISABLED
)
}
let
(
:project
)
{
create
(
:
empty_project
,
wiki_access_level:
ProjectFeature
::
DISABLED
)
}
subject
{
described_class
.
allowed
(
project
.
owner
,
project
)
}
subject
{
described_class
.
allowed
(
project
.
owner
,
project
)
}
...
...
spec/models/ci/build_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
Build
,
:models
do
describe
Ci
::
Build
,
:models
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:test_trace
)
{
'This is a test'
}
let
(
:test_trace
)
{
'This is a test'
}
...
...
spec/models/ci/pipeline_spec.rb
View file @
fcb37542
...
@@ -284,7 +284,7 @@ describe Ci::Pipeline, models: true do
...
@@ -284,7 +284,7 @@ describe Ci::Pipeline, models: true do
end
end
describe
'merge request metrics'
do
describe
'merge request metrics'
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
FactoryGirl
.
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
project
.
repository
.
commit
(
'master'
).
id
)
}
let
(
:pipeline
)
{
FactoryGirl
.
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
project
.
repository
.
commit
(
'master'
).
id
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
}
...
@@ -339,7 +339,7 @@ describe Ci::Pipeline, models: true do
...
@@ -339,7 +339,7 @@ describe Ci::Pipeline, models: true do
end
end
context
'with non-empty project'
do
context
'with non-empty project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
create
(
:ci_pipeline
,
...
@@ -890,7 +890,7 @@ describe Ci::Pipeline, models: true do
...
@@ -890,7 +890,7 @@ describe Ci::Pipeline, models: true do
end
end
describe
"#merge_requests"
do
describe
"#merge_requests"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
FactoryGirl
.
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
project
.
repository
.
commit
(
'master'
).
id
)
}
let
(
:pipeline
)
{
FactoryGirl
.
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
project
.
repository
.
commit
(
'master'
).
id
)
}
it
"returns merge requests whose `diff_head_sha` matches the pipeline's SHA"
do
it
"returns merge requests whose `diff_head_sha` matches the pipeline's SHA"
do
...
@@ -956,7 +956,7 @@ describe Ci::Pipeline, models: true do
...
@@ -956,7 +956,7 @@ describe Ci::Pipeline, models: true do
end
end
describe
'notifications when pipeline success or failed'
do
describe
'notifications when pipeline success or failed'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
create
(
:ci_pipeline
,
...
...
spec/models/ci/runner_spec.rb
View file @
fcb37542
...
@@ -91,8 +91,7 @@ describe Ci::Runner, models: true do
...
@@ -91,8 +91,7 @@ describe Ci::Runner, models: true do
end
end
describe
'#can_pick?'
do
describe
'#can_pick?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
...
@@ -321,8 +320,8 @@ describe Ci::Runner, models: true do
...
@@ -321,8 +320,8 @@ describe Ci::Runner, models: true do
describe
'.assignable_for'
do
describe
'.assignable_for'
do
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:another_project
)
{
create
(
:project
)
}
let
(
:another_project
)
{
create
(
:
empty_
project
)
}
before
do
before
do
project
.
runners
<<
runner
project
.
runners
<<
runner
...
...
spec/models/commit_range_spec.rb
View file @
fcb37542
...
@@ -7,7 +7,7 @@ describe CommitRange, models: true do
...
@@ -7,7 +7,7 @@ describe CommitRange, models: true do
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
end
end
let!
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let!
(
:commit1
)
{
project
.
commit
(
"HEAD~2"
)
}
let!
(
:commit1
)
{
project
.
commit
(
"HEAD~2"
)
}
let!
(
:commit2
)
{
project
.
commit
}
let!
(
:commit2
)
{
project
.
commit
}
...
...
spec/models/commit_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Commit
,
models:
true
do
describe
Commit
,
models:
true
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
describe
'modules'
do
describe
'modules'
do
...
@@ -34,7 +34,7 @@ describe Commit, models: true do
...
@@ -34,7 +34,7 @@ describe Commit, models: true do
end
end
describe
'#to_reference'
do
describe
'#to_reference'
do
let
(
:project
)
{
create
(
:project
,
path:
'sample-project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
path:
'sample-project'
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
it
'returns a String reference to the object'
do
it
'returns a String reference to the object'
do
...
@@ -42,13 +42,13 @@ describe Commit, models: true do
...
@@ -42,13 +42,13 @@ describe Commit, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:project
,
:repository
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
commit
.
to_reference
(
another_project
)).
to
eq
"sample-project@
#{
commit
.
id
}
"
expect
(
commit
.
to_reference
(
another_project
)).
to
eq
"sample-project@
#{
commit
.
id
}
"
end
end
end
end
describe
'#reference_link_text'
do
describe
'#reference_link_text'
do
let
(
:project
)
{
create
(
:project
,
path:
'sample-project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
path:
'sample-project'
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
it
'returns a String reference to the object'
do
it
'returns a String reference to the object'
do
...
@@ -56,7 +56,7 @@ describe Commit, models: true do
...
@@ -56,7 +56,7 @@ describe Commit, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:project
,
:repository
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
commit
.
reference_link_text
(
another_project
)).
to
eq
"sample-project@
#{
commit
.
short_id
}
"
expect
(
commit
.
reference_link_text
(
another_project
)).
to
eq
"sample-project@
#{
commit
.
short_id
}
"
end
end
end
end
...
@@ -131,7 +131,7 @@ eos
...
@@ -131,7 +131,7 @@ eos
describe
'#closes_issues'
do
describe
'#closes_issues'
do
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:other_project
)
{
create
:project
,
:public
}
let
(
:other_project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:other_issue
)
{
create
:issue
,
project:
other_project
}
let
(
:other_issue
)
{
create
:issue
,
project:
other_project
}
let
(
:commiter
)
{
create
:user
}
let
(
:commiter
)
{
create
:user
}
...
@@ -154,7 +154,7 @@ eos
...
@@ -154,7 +154,7 @@ eos
end
end
it_behaves_like
'a mentionable'
do
it_behaves_like
'a mentionable'
do
subject
{
create
(
:project
).
commit
}
subject
{
create
(
:project
,
:repository
).
commit
}
let
(
:author
)
{
create
(
:user
,
email:
subject
.
author_email
)
}
let
(
:author
)
{
create
(
:user
,
email:
subject
.
author_email
)
}
let
(
:backref_text
)
{
"commit
#{
subject
.
id
}
"
}
let
(
:backref_text
)
{
"commit
#{
subject
.
id
}
"
}
...
...
spec/models/commit_status_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
CommitStatus
,
models:
true
do
describe
CommitStatus
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
...
...
spec/models/compare_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Compare
,
models:
true
do
describe
Compare
,
models:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
let
(
:start_commit
)
{
sample_image_commit
}
let
(
:start_commit
)
{
sample_image_commit
}
...
...
spec/models/concerns/issuable_spec.rb
View file @
fcb37542
...
@@ -301,7 +301,7 @@ describe Issue, "Issuable" do
...
@@ -301,7 +301,7 @@ describe Issue, "Issuable" do
end
end
describe
'#labels_array'
do
describe
'#labels_array'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
@@ -315,7 +315,7 @@ describe Issue, "Issuable" do
...
@@ -315,7 +315,7 @@ describe Issue, "Issuable" do
end
end
describe
'#user_notes_count'
do
describe
'#user_notes_count'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
...
@@ -359,7 +359,7 @@ describe Issue, "Issuable" do
...
@@ -359,7 +359,7 @@ describe Issue, "Issuable" do
end
end
describe
".with_label"
do
describe
".with_label"
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
let
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
let
(
:enhancement
)
{
create
(
:label
,
project:
project
,
title:
'enhancement'
)
}
let
(
:enhancement
)
{
create
(
:label
,
project:
project
,
title:
'enhancement'
)
}
...
...
spec/models/concerns/mentionable_spec.rb
View file @
fcb37542
...
@@ -13,7 +13,7 @@ describe Mentionable do
...
@@ -13,7 +13,7 @@ describe Mentionable do
end
end
describe
'references'
do
describe
'references'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:mentionable
)
{
Example
.
new
}
let
(
:mentionable
)
{
Example
.
new
}
it
'excludes JIRA references'
do
it
'excludes JIRA references'
do
...
@@ -83,13 +83,13 @@ describe Issue, "Mentionable" do
...
@@ -83,13 +83,13 @@ describe Issue, "Mentionable" do
end
end
describe
'#create_cross_references!'
do
describe
'#create_cross_references!'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:author
)
{
build
(
:user
)
}
let
(
:author
)
{
build
(
:user
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit2
)
{
project
.
commit
}
let
(
:commit2
)
{
project
.
commit
}
let!
(
:issue
)
do
let!
(
:issue
)
do
create
(
:issue
,
project:
project
,
description:
commit
.
to_reference
)
create
(
:issue
,
project:
project
,
description:
"See
#{
commit
.
to_reference
}
"
)
end
end
it
'correctly removes already-mentioned Commits'
do
it
'correctly removes already-mentioned Commits'
do
...
@@ -100,7 +100,7 @@ describe Issue, "Mentionable" do
...
@@ -100,7 +100,7 @@ describe Issue, "Mentionable" do
end
end
describe
'#create_new_cross_references!'
do
describe
'#create_new_cross_references!'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:author
)
{
create
(
:author
)
}
let
(
:author
)
{
create
(
:author
)
}
let
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
,
author:
author
)
}
let
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
,
author:
author
)
}
...
...
spec/models/concerns/milestoneish_spec.rb
View file @
fcb37542
...
@@ -7,7 +7,7 @@ describe Milestone, 'Milestoneish' do
...
@@ -7,7 +7,7 @@ describe Milestone, 'Milestoneish' do
let
(
:member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
let!
(
:security_issue_1
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
author
,
milestone:
milestone
)
}
let!
(
:security_issue_1
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
author
,
milestone:
milestone
)
}
...
...
spec/models/concerns/project_features_compatibility_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
ProjectFeaturesCompatibility
do
describe
ProjectFeaturesCompatibility
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:features
)
{
%w(issues wiki builds merge_requests snippets)
}
let
(
:features
)
{
%w(issues wiki builds merge_requests snippets)
}
# We had issues_enabled, snippets_enabled, builds_enabled, merge_requests_enabled and issues_enabled fields on projects table
# We had issues_enabled, snippets_enabled, builds_enabled, merge_requests_enabled and issues_enabled fields on projects table
...
...
spec/models/cycle_analytics/code_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#code'
,
feature:
true
do
describe
'CycleAnalytics#code'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/cycle_analytics/issue_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#issue'
,
models:
true
do
describe
'CycleAnalytics#issue'
,
models:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/cycle_analytics/plan_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#plan'
,
feature:
true
do
describe
'CycleAnalytics#plan'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/cycle_analytics/production_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#production'
,
feature:
true
do
describe
'CycleAnalytics#production'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/cycle_analytics/review_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#review'
,
feature:
true
do
describe
'CycleAnalytics#review'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/cycle_analytics/staging_spec.rb
View file @
fcb37542
...
@@ -3,9 +3,10 @@ require 'spec_helper'
...
@@ -3,9 +3,10 @@ require 'spec_helper'
describe
'CycleAnalytics#staging'
,
feature:
true
do
describe
'CycleAnalytics#staging'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
generate_cycle_analytics_spec
(
generate_cycle_analytics_spec
(
...
...
spec/models/cycle_analytics/test_spec.rb
View file @
fcb37542
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
'CycleAnalytics#test'
,
feature:
true
do
describe
'CycleAnalytics#test'
,
feature:
true
do
extend
CycleAnalyticsHelpers
::
TestGeneration
extend
CycleAnalyticsHelpers
::
TestGeneration
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:from_date
)
{
10
.
days
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
subject
{
CycleAnalytics
.
new
(
project
,
from:
from_date
)
}
...
...
spec/models/deploy_keys_project_spec.rb
View file @
fcb37542
...
@@ -12,7 +12,7 @@ describe DeployKeysProject, models: true do
...
@@ -12,7 +12,7 @@ describe DeployKeysProject, models: true do
end
end
describe
"Destroying"
do
describe
"Destroying"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
subject
{
create
(
:deploy_keys_project
,
project:
project
)
}
subject
{
create
(
:deploy_keys_project
,
project:
project
)
}
let
(
:deploy_key
)
{
subject
.
deploy_key
}
let
(
:deploy_key
)
{
subject
.
deploy_key
}
...
@@ -39,7 +39,7 @@ describe DeployKeysProject, models: true do
...
@@ -39,7 +39,7 @@ describe DeployKeysProject, models: true do
end
end
context
"when the deploy key is used by more than one project"
do
context
"when the deploy key is used by more than one project"
do
let!
(
:other_project
)
{
create
(
:project
)
}
let!
(
:other_project
)
{
create
(
:
empty_
project
)
}
before
do
before
do
other_project
.
deploy_keys
<<
deploy_key
other_project
.
deploy_keys
<<
deploy_key
...
...
spec/models/deployment_spec.rb
View file @
fcb37542
...
@@ -17,7 +17,7 @@ describe Deployment, models: true do
...
@@ -17,7 +17,7 @@ describe Deployment, models: true do
it
{
is_expected
.
to
validate_presence_of
(
:sha
)
}
it
{
is_expected
.
to
validate_presence_of
(
:sha
)
}
describe
'#includes_commit?'
do
describe
'#includes_commit?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let
(
:deployment
)
do
let
(
:deployment
)
do
create
(
:deployment
,
environment:
environment
,
sha:
project
.
commit
.
id
)
create
(
:deployment
,
environment:
environment
,
sha:
project
.
commit
.
id
)
...
...
spec/models/diff_note_spec.rb
View file @
fcb37542
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
DiffNote
,
models:
true
do
describe
DiffNote
,
models:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:
project
)
{
create
(
:projec
t
)
}
let
(
:
merge_request
)
{
create
(
:merge_reques
t
)
}
let
(
:
merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:
project
)
{
merge_request
.
project
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:path
)
{
"files/ruby/popen.rb"
}
let
(
:path
)
{
"files/ruby/popen.rb"
}
...
...
spec/models/environment_spec.rb
View file @
fcb37542
...
@@ -32,7 +32,7 @@ describe Environment, models: true do
...
@@ -32,7 +32,7 @@ describe Environment, models: true do
end
end
describe
'#includes_commit?'
do
describe
'#includes_commit?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'without a last deployment'
do
context
'without a last deployment'
do
it
"returns false"
do
it
"returns false"
do
...
@@ -81,7 +81,7 @@ describe Environment, models: true do
...
@@ -81,7 +81,7 @@ describe Environment, models: true do
end
end
describe
'#first_deployment_for'
do
describe
'#first_deployment_for'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
ref:
commit
.
parent
.
id
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
ref:
commit
.
parent
.
id
)
}
let!
(
:deployment1
)
{
create
(
:deployment
,
environment:
environment
,
ref:
commit
.
id
)
}
let!
(
:deployment1
)
{
create
(
:deployment
,
environment:
environment
,
ref:
commit
.
id
)
}
let
(
:head_commit
)
{
project
.
commit
}
let
(
:head_commit
)
{
project
.
commit
}
...
...
spec/models/event_spec.rb
View file @
fcb37542
...
@@ -27,7 +27,7 @@ describe Event, models: true do
...
@@ -27,7 +27,7 @@ describe Event, models: true do
end
end
describe
"Push event"
do
describe
"Push event"
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:private
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
owner
}
let
(
:event
)
{
create_event
(
project
,
user
)
}
let
(
:event
)
{
create_event
(
project
,
user
)
}
...
@@ -187,7 +187,7 @@ describe Event, models: true do
...
@@ -187,7 +187,7 @@ describe Event, models: true do
end
end
context
'merge request diff note event'
do
context
'merge request diff note event'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:note_on_merge_request
)
{
create
(
:legacy_diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:note_on_merge_request
)
{
create
(
:legacy_diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:target
)
{
note_on_merge_request
}
let
(
:target
)
{
note_on_merge_request
}
...
@@ -202,7 +202,7 @@ describe Event, models: true do
...
@@ -202,7 +202,7 @@ describe Event, models: true do
end
end
context
'private project'
do
context
'private project'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:private
)
}
it
do
it
do
expect
(
event
.
visible_to_user?
(
non_member
)).
to
eq
false
expect
(
event
.
visible_to_user?
(
non_member
)).
to
eq
false
...
...
spec/models/forked_project_link_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
ForkedProjectLink
,
"add link on fork"
do
describe
ForkedProjectLink
,
"add link on fork"
do
let
(
:project_from
)
{
create
(
:project
)
}
let
(
:project_from
)
{
create
(
:project
,
:repository
)
}
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
namespace
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
namespace
)
}
...
@@ -21,7 +21,7 @@ end
...
@@ -21,7 +21,7 @@ end
describe
'#forked?'
do
describe
'#forked?'
do
let
(
:forked_project_link
)
{
build
(
:forked_project_link
)
}
let
(
:forked_project_link
)
{
build
(
:forked_project_link
)
}
let
(
:project_from
)
{
create
(
:project
)
}
let
(
:project_from
)
{
create
(
:project
,
:repository
)
}
let
(
:project_to
)
{
create
(
:project
,
forked_project_link:
forked_project_link
)
}
let
(
:project_to
)
{
create
(
:project
,
forked_project_link:
forked_project_link
)
}
before
:each
do
before
:each
do
...
...
spec/models/global_milestone_spec.rb
View file @
fcb37542
...
@@ -4,9 +4,9 @@ describe GlobalMilestone, models: true do
...
@@ -4,9 +4,9 @@ describe GlobalMilestone, models: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project1
)
{
create
(
:project
,
group:
group
)
}
let
(
:project1
)
{
create
(
:
empty_
project
,
group:
group
)
}
let
(
:project2
)
{
create
(
:project
,
path:
'gitlab-ci'
,
group:
group
)
}
let
(
:project2
)
{
create
(
:
empty_
project
,
path:
'gitlab-ci'
,
group:
group
)
}
let
(
:project3
)
{
create
(
:project
,
path:
'cookbook-gitlab'
,
group:
group
)
}
let
(
:project3
)
{
create
(
:
empty_
project
,
path:
'cookbook-gitlab'
,
group:
group
)
}
describe
'.build_collection'
do
describe
'.build_collection'
do
let
(
:milestone1_due_date
)
{
2
.
weeks
.
from_now
.
to_date
}
let
(
:milestone1_due_date
)
{
2
.
weeks
.
from_now
.
to_date
}
...
...
spec/models/group_milestone_spec.rb
View file @
fcb37542
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
GroupMilestone
,
models:
true
do
describe
GroupMilestone
,
models:
true
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
group:
group
)
}
let
(
:project_milestone
)
do
let
(
:project_milestone
)
do
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project
)
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project
)
end
end
...
...
spec/models/guest_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Guest
,
lib:
true
do
describe
Guest
,
lib:
true
do
let
(
:public_project
)
{
create
(
:
project
,
:public
)
}
let
(
:public_project
)
{
build_stubbed
(
:empty_
project
,
:public
)
}
let
(
:private_project
)
{
create
(
:
project
,
:private
)
}
let
(
:private_project
)
{
build_stubbed
(
:empty_
project
,
:private
)
}
let
(
:internal_project
)
{
create
(
:
project
,
:internal
)
}
let
(
:internal_project
)
{
build_stubbed
(
:empty_
project
,
:internal
)
}
describe
'.can_pull?'
do
describe
'.can_pull?'
do
context
'when project is private'
do
context
'when project is private'
do
...
...
spec/models/hooks/system_hook_spec.rb
View file @
fcb37542
...
@@ -4,7 +4,7 @@ describe SystemHook, models: true do
...
@@ -4,7 +4,7 @@ describe SystemHook, models: true do
describe
"execute"
do
describe
"execute"
do
let
(
:system_hook
)
{
create
(
:system_hook
)
}
let
(
:system_hook
)
{
create
(
:system_hook
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
user
.
namespace
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
before
do
before
do
...
...
spec/models/hooks/web_hook_spec.rb
View file @
fcb37542
...
@@ -25,7 +25,7 @@ describe WebHook, models: true do
...
@@ -25,7 +25,7 @@ describe WebHook, models: true do
end
end
describe
"execute"
do
describe
"execute"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:project_hook
)
{
create
(
:project_hook
)
}
let
(
:project_hook
)
{
create
(
:project_hook
)
}
before
(
:each
)
do
before
(
:each
)
do
...
...
spec/models/issue/metrics_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Issue
::
Metrics
,
models:
true
do
describe
Issue
::
Metrics
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
subject
{
create
(
:issue
,
project:
project
)
}
subject
{
create
(
:issue
,
project:
project
)
}
...
...
spec/models/issue_collection_spec.rb
View file @
fcb37542
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
IssueCollection
do
describe
IssueCollection
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let
(
:collection
)
{
described_class
.
new
([
issue1
,
issue2
])
}
let
(
:collection
)
{
described_class
.
new
([
issue1
,
issue2
])
}
...
...
spec/models/issue_spec.rb
View file @
fcb37542
...
@@ -35,7 +35,7 @@ describe Issue, models: true do
...
@@ -35,7 +35,7 @@ describe Issue, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:
empty_
project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
issue
.
to_reference
(
another_project
)).
to
eq
"sample-project#1"
expect
(
issue
.
to_reference
(
another_project
)).
to
eq
"sample-project#1"
end
end
end
end
...
@@ -60,9 +60,9 @@ describe Issue, models: true do
...
@@ -60,9 +60,9 @@ describe Issue, models: true do
end
end
describe
'#closed_by_merge_requests'
do
describe
'#closed_by_merge_requests'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
state:
"opened"
)}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)}
let
(
:closed_issue
)
{
build
(
:issue
,
project:
project
,
state:
"closed"
)}
let
(
:closed_issue
)
{
build
(
:issue
,
:closed
,
project:
project
)}
let
(
:mr
)
do
let
(
:mr
)
do
opts
=
{
opts
=
{
...
@@ -104,7 +104,7 @@ describe Issue, models: true do
...
@@ -104,7 +104,7 @@ describe Issue, models: true do
describe
'#referenced_merge_requests'
do
describe
'#referenced_merge_requests'
do
it
'returns the referenced merge requests'
do
it
'returns the referenced merge requests'
do
project
=
create
(
:project
,
:public
)
project
=
create
(
:
empty_
project
,
:public
)
mr1
=
create
(
:merge_request
,
mr1
=
create
(
:merge_request
,
source_project:
project
,
source_project:
project
,
...
@@ -137,7 +137,7 @@ describe Issue, models: true do
...
@@ -137,7 +137,7 @@ describe Issue, models: true do
end
end
context
'user is reporter in project issue belongs to'
do
context
'user is reporter in project issue belongs to'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
...
@@ -151,7 +151,7 @@ describe Issue, models: true do
...
@@ -151,7 +151,7 @@ describe Issue, models: true do
context
'checking destination project also'
do
context
'checking destination project also'
do
subject
{
issue
.
can_move?
(
user
,
to_project
)
}
subject
{
issue
.
can_move?
(
user
,
to_project
)
}
let
(
:to_project
)
{
create
(
:project
)
}
let
(
:to_project
)
{
create
(
:
empty_
project
)
}
context
'destination project allowed'
do
context
'destination project allowed'
do
before
{
to_project
.
team
<<
[
user
,
:reporter
]
}
before
{
to_project
.
team
<<
[
user
,
:reporter
]
}
...
@@ -246,7 +246,7 @@ describe Issue, models: true do
...
@@ -246,7 +246,7 @@ describe Issue, models: true do
describe
'#participants'
do
describe
'#participants'
do
context
'using a public project'
do
context
'using a public project'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:note1
)
do
let!
(
:note1
)
do
...
@@ -268,7 +268,7 @@ describe Issue, models: true do
...
@@ -268,7 +268,7 @@ describe Issue, models: true do
context
'using a private project'
do
context
'using a private project'
do
it
'does not include mentioned users that do not have access to the project'
do
it
'does not include mentioned users that do not have access to the project'
do
project
=
create
(
:project
)
project
=
create
(
:
empty_
project
)
user
=
create
(
:user
)
user
=
create
(
:user
)
issue
=
create
(
:issue
,
project:
project
)
issue
=
create
(
:issue
,
project:
project
)
...
...
spec/models/member_spec.rb
View file @
fcb37542
...
@@ -481,7 +481,7 @@ describe Member, models: true do
...
@@ -481,7 +481,7 @@ describe Member, models: true do
describe
"destroying a record"
,
truncate:
true
do
describe
"destroying a record"
,
truncate:
true
do
it
"refreshes user's authorized projects"
do
it
"refreshes user's authorized projects"
do
project
=
create
(
:project
,
:private
)
project
=
create
(
:
empty_
project
,
:private
)
user
=
create
(
:user
)
user
=
create
(
:user
)
member
=
project
.
team
<<
[
user
,
:reporter
]
member
=
project
.
team
<<
[
user
,
:reporter
]
...
...
spec/models/members/project_member_spec.rb
View file @
fcb37542
...
@@ -83,8 +83,8 @@ describe ProjectMember, models: true do
...
@@ -83,8 +83,8 @@ describe ProjectMember, models: true do
describe
'.import_team'
do
describe
'.import_team'
do
before
do
before
do
@project_1
=
create
:project
@project_1
=
create
(
:empty_project
)
@project_2
=
create
:project
@project_2
=
create
(
:empty_project
)
@user_1
=
create
:user
@user_1
=
create
:user
@user_2
=
create
:user
@user_2
=
create
:user
...
@@ -131,8 +131,8 @@ describe ProjectMember, models: true do
...
@@ -131,8 +131,8 @@ describe ProjectMember, models: true do
describe
'.truncate_teams'
do
describe
'.truncate_teams'
do
before
do
before
do
@project_1
=
create
:project
@project_1
=
create
(
:empty_project
)
@project_2
=
create
:project
@project_2
=
create
(
:empty_project
)
@user_1
=
create
:user
@user_1
=
create
:user
@user_2
=
create
:user
@user_2
=
create
:user
...
...
spec/models/merge_request/metrics_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
MergeRequest
::
Metrics
,
models:
true
do
describe
MergeRequest
::
Metrics
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
subject
{
create
(
:merge_request
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
describe
"when recording the default set of metrics on merge request save"
do
describe
"when recording the default set of metrics on merge request save"
do
it
"records the merge time"
do
it
"records the merge time"
do
...
...
spec/models/milestone_spec.rb
View file @
fcb37542
...
@@ -24,7 +24,7 @@ describe Milestone, models: true do
...
@@ -24,7 +24,7 @@ describe Milestone, models: true do
it
{
is_expected
.
to
have_many
(
:issues
)
}
it
{
is_expected
.
to
have_many
(
:issues
)
}
end
end
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -44,7 +44,7 @@ describe Milestone, models: true do
...
@@ -44,7 +44,7 @@ describe Milestone, models: true do
end
end
it
"accepts the same title in another project"
do
it
"accepts the same title in another project"
do
project
=
build
(
:project
)
project
=
build
(
:
empty_
project
)
new_milestone
=
Milestone
.
new
(
project:
project
,
title:
milestone
.
title
)
new_milestone
=
Milestone
.
new
(
project:
project
,
title:
milestone
.
title
)
expect
(
new_milestone
).
to
be_valid
expect
(
new_milestone
).
to
be_valid
...
@@ -257,7 +257,7 @@ describe Milestone, models: true do
...
@@ -257,7 +257,7 @@ describe Milestone, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:
empty_
project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
milestone
.
to_reference
(
another_project
)).
to
eq
"sample-project%1"
expect
(
milestone
.
to_reference
(
another_project
)).
to
eq
"sample-project%1"
end
end
end
end
...
...
spec/models/namespace_spec.rb
View file @
fcb37542
...
@@ -107,7 +107,7 @@ describe Namespace, models: true do
...
@@ -107,7 +107,7 @@ describe Namespace, models: true do
describe
'#move_dir'
do
describe
'#move_dir'
do
before
do
before
do
@namespace
=
create
:namespace
@namespace
=
create
:namespace
@project
=
create
:project
,
namespace:
@namespace
@project
=
create
(
:empty_project
,
namespace:
@namespace
)
allow
(
@namespace
).
to
receive
(
:path_changed?
).
and_return
(
true
)
allow
(
@namespace
).
to
receive
(
:path_changed?
).
and_return
(
true
)
end
end
...
@@ -139,7 +139,7 @@ describe Namespace, models: true do
...
@@ -139,7 +139,7 @@ describe Namespace, models: true do
end
end
describe
:rm_dir
do
describe
:rm_dir
do
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
namespace:
namespace
)
}
let!
(
:path
)
{
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
.
default
,
namespace
.
path
)
}
let!
(
:path
)
{
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
.
default
,
namespace
.
path
)
}
it
"removes its dirs when deleted"
do
it
"removes its dirs when deleted"
do
...
...
spec/models/network/graph_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Network
::
Graph
,
models:
true
do
describe
Network
::
Graph
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let!
(
:note_on_commit
)
{
create
(
:note_on_commit
,
project:
project
)
}
let!
(
:note_on_commit
)
{
create
(
:note_on_commit
,
project:
project
)
}
it
'#initialize'
do
it
'#initialize'
do
...
...
spec/models/note_spec.rb
View file @
fcb37542
...
@@ -42,7 +42,7 @@ describe Note, models: true do
...
@@ -42,7 +42,7 @@ describe Note, models: true do
context
'when noteable and note project differ'
do
context
'when noteable and note project differ'
do
subject
do
subject
do
build
(
:note
,
noteable:
build_stubbed
(
:issue
),
build
(
:note
,
noteable:
build_stubbed
(
:issue
),
project:
build_stubbed
(
:project
))
project:
build_stubbed
(
:
empty_
project
))
end
end
it
{
is_expected
.
to
be_invalid
}
it
{
is_expected
.
to
be_invalid
}
...
@@ -93,8 +93,8 @@ describe Note, models: true do
...
@@ -93,8 +93,8 @@ describe Note, models: true do
describe
'authorization'
do
describe
'authorization'
do
before
do
before
do
@p1
=
create
(
:project
)
@p1
=
create
(
:
empty_
project
)
@p2
=
create
(
:project
)
@p2
=
create
(
:
empty_
project
)
@u1
=
create
(
:user
)
@u1
=
create
(
:user
)
@u2
=
create
(
:user
)
@u2
=
create
(
:user
)
@u3
=
create
(
:user
)
@u3
=
create
(
:user
)
...
@@ -191,10 +191,10 @@ describe Note, models: true do
...
@@ -191,10 +191,10 @@ describe Note, models: true do
describe
"cross_reference_not_visible_for?"
do
describe
"cross_reference_not_visible_for?"
do
let
(
:private_user
)
{
create
(
:user
)
}
let
(
:private_user
)
{
create
(
:user
)
}
let
(
:private_project
)
{
create
(
:
project
,
namespace:
private_user
.
namespace
).
tap
{
|
p
|
p
.
team
<<
[
private_user
,
:master
]
}
}
let
(
:private_project
)
{
create
(
:
empty_project
,
namespace:
private_user
.
namespace
)
{
|
p
|
p
.
team
<<
[
private_user
,
:master
]
}
}
let
(
:private_issue
)
{
create
(
:issue
,
project:
private_project
)
}
let
(
:private_issue
)
{
create
(
:issue
,
project:
private_project
)
}
let
(
:ext_proj
)
{
create
(
:project
,
:public
)
}
let
(
:ext_proj
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:ext_issue
)
{
create
(
:issue
,
project:
ext_proj
)
}
let
(
:ext_issue
)
{
create
(
:issue
,
project:
ext_proj
)
}
let
(
:note
)
do
let
(
:note
)
do
...
@@ -237,7 +237,7 @@ describe Note, models: true do
...
@@ -237,7 +237,7 @@ describe Note, models: true do
describe
'#participants'
do
describe
'#participants'
do
it
'includes the note author'
do
it
'includes the note author'
do
project
=
create
(
:project
,
:public
)
project
=
create
(
:
empty_
project
,
:public
)
issue
=
create
(
:issue
,
project:
project
)
issue
=
create
(
:issue
,
project:
project
)
note
=
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
)
note
=
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
)
...
...
spec/models/project_feature_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
ProjectFeature
do
describe
ProjectFeature
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'#feature_available?'
do
describe
'#feature_available?'
do
...
@@ -35,7 +35,7 @@ describe ProjectFeature do
...
@@ -35,7 +35,7 @@ describe ProjectFeature do
it
"returns true when user is a member of project group"
do
it
"returns true when user is a member of project group"
do
group
=
create
(
:group
)
group
=
create
(
:group
)
project
=
create
(
:project
,
namespace:
group
)
project
=
create
(
:
empty_
project
,
namespace:
group
)
group
.
add_developer
(
user
)
group
.
add_developer
(
user
)
features
.
each
do
|
feature
|
features
.
each
do
|
feature
|
...
...
spec/models/project_group_link_spec.rb
View file @
fcb37542
...
@@ -17,7 +17,7 @@ describe ProjectGroupLink do
...
@@ -17,7 +17,7 @@ describe ProjectGroupLink do
describe
"destroying a record"
,
truncate:
true
do
describe
"destroying a record"
,
truncate:
true
do
it
"refreshes group users' authorized projects"
do
it
"refreshes group users' authorized projects"
do
project
=
create
(
:project
,
:private
)
project
=
create
(
:
empty_
project
,
:private
)
group
=
create
(
:group
)
group
=
create
(
:group
)
reporter
=
create
(
:user
)
reporter
=
create
(
:user
)
group_users
=
group
.
users
group_users
=
group
.
users
...
...
spec/models/project_label_spec.rb
View file @
fcb37542
...
@@ -100,7 +100,7 @@ describe ProjectLabel, models: true do
...
@@ -100,7 +100,7 @@ describe ProjectLabel, models: true do
end
end
context
'cross project reference'
do
context
'cross project reference'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'using name'
do
context
'using name'
do
it
'returns cross reference with label name'
do
it
'returns cross reference with label name'
do
...
...
spec/models/project_services/asana_service_spec.rb
View file @
fcb37542
...
@@ -18,7 +18,7 @@ describe AsanaService, models: true do
...
@@ -18,7 +18,7 @@ describe AsanaService, models: true do
describe
'Execute'
do
describe
'Execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
def
create_data_for_commits
(
*
messages
)
def
create_data_for_commits
(
*
messages
)
{
{
...
...
spec/models/project_services/assembla_service_spec.rb
View file @
fcb37542
...
@@ -8,7 +8,7 @@ describe AssemblaService, models: true do
...
@@ -8,7 +8,7 @@ describe AssemblaService, models: true do
describe
"Execute"
do
describe
"Execute"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
@assembla_service
=
AssemblaService
.
new
@assembla_service
=
AssemblaService
.
new
...
...
spec/models/project_services/campfire_service_spec.rb
View file @
fcb37542
...
@@ -22,7 +22,7 @@ describe CampfireService, models: true do
...
@@ -22,7 +22,7 @@ describe CampfireService, models: true do
describe
"#execute"
do
describe
"#execute"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
@campfire_service
=
CampfireService
.
new
@campfire_service
=
CampfireService
.
new
...
...
spec/models/project_services/drone_ci_service_spec.rb
View file @
fcb37542
...
@@ -27,7 +27,7 @@ describe DroneCiService, models: true, caching: true do
...
@@ -27,7 +27,7 @@ describe DroneCiService, models: true, caching: true do
shared_context
:drone_ci_service
do
shared_context
:drone_ci_service
do
let
(
:drone
)
{
DroneCiService
.
new
}
let
(
:drone
)
{
DroneCiService
.
new
}
let
(
:project
)
{
create
(
:project
,
name:
'project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
name:
'project'
)
}
let
(
:path
)
{
"
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
"
}
let
(
:path
)
{
"
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
"
}
let
(
:drone_url
)
{
'http://drone.example.com'
}
let
(
:drone_url
)
{
'http://drone.example.com'
}
let
(
:sha
)
{
'2ab7834c'
}
let
(
:sha
)
{
'2ab7834c'
}
...
...
spec/models/project_services/external_wiki_service_spec.rb
View file @
fcb37542
...
@@ -23,7 +23,7 @@ describe ExternalWikiService, models: true do
...
@@ -23,7 +23,7 @@ describe ExternalWikiService, models: true do
end
end
describe
'External wiki'
do
describe
'External wiki'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'when it is active'
do
context
'when it is active'
do
before
do
before
do
...
...
spec/models/project_services/flowdock_service_spec.rb
View file @
fcb37542
...
@@ -22,7 +22,7 @@ describe FlowdockService, models: true do
...
@@ -22,7 +22,7 @@ describe FlowdockService, models: true do
describe
"Execute"
do
describe
"Execute"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
@flowdock_service
=
FlowdockService
.
new
@flowdock_service
=
FlowdockService
.
new
...
...
spec/models/project_services/gemnasium_service_spec.rb
View file @
fcb37542
...
@@ -24,7 +24,7 @@ describe GemnasiumService, models: true do
...
@@ -24,7 +24,7 @@ describe GemnasiumService, models: true do
describe
"Execute"
do
describe
"Execute"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
@gemnasium_service
=
GemnasiumService
.
new
@gemnasium_service
=
GemnasiumService
.
new
...
...
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
View file @
fcb37542
...
@@ -8,21 +8,21 @@ describe GitlabIssueTrackerService, models: true do
...
@@ -8,21 +8,21 @@ describe GitlabIssueTrackerService, models: true do
describe
'Validations'
do
describe
'Validations'
do
context
'when service is active'
do
context
'when service is active'
do
subject
{
described_class
.
new
(
project:
create
(
:project
),
active:
true
)
}
subject
{
described_class
.
new
(
project:
create
(
:
empty_
project
),
active:
true
)
}
it
{
is_expected
.
to
validate_presence_of
(
:issues_url
)
}
it
{
is_expected
.
to
validate_presence_of
(
:issues_url
)
}
it_behaves_like
'issue tracker service URL attribute'
,
:issues_url
it_behaves_like
'issue tracker service URL attribute'
,
:issues_url
end
end
context
'when service is inactive'
do
context
'when service is inactive'
do
subject
{
described_class
.
new
(
project:
create
(
:project
),
active:
false
)
}
subject
{
described_class
.
new
(
project:
create
(
:
empty_
project
),
active:
false
)
}
it
{
is_expected
.
not_to
validate_presence_of
(
:issues_url
)
}
it
{
is_expected
.
not_to
validate_presence_of
(
:issues_url
)
}
end
end
end
end
describe
'project and issue urls'
do
describe
'project and issue urls'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'with absolute urls'
do
context
'with absolute urls'
do
before
do
before
do
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
fcb37542
...
@@ -22,8 +22,8 @@ describe HipchatService, models: true do
...
@@ -22,8 +22,8 @@ describe HipchatService, models: true do
describe
"Execute"
do
describe
"Execute"
do
let
(
:hipchat
)
{
HipchatService
.
new
}
let
(
:hipchat
)
{
HipchatService
.
new
}
let
(
:user
)
{
create
(
:user
,
username:
'username'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'project'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:api_url
)
{
'https://hipchat.example.com/v2/room/123456/notification?auth_token=verySecret'
}
let
(
:api_url
)
{
'https://hipchat.example.com/v2/room/123456/notification?auth_token=verySecret'
}
let
(
:project_name
)
{
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
}
let
(
:project_name
)
{
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
}
let
(
:token
)
{
'verySecret'
}
let
(
:token
)
{
'verySecret'
}
...
@@ -165,7 +165,7 @@ describe HipchatService, models: true do
...
@@ -165,7 +165,7 @@ describe HipchatService, models: true do
context
"Note events"
do
context
"Note events"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
context
'when commit comment event triggered'
do
context
'when commit comment event triggered'
do
let
(
:commit_note
)
do
let
(
:commit_note
)
do
...
...
spec/models/project_services/irker_service_spec.rb
View file @
fcb37542
...
@@ -25,7 +25,7 @@ describe IrkerService, models: true do
...
@@ -25,7 +25,7 @@ describe IrkerService, models: true do
describe
'Execute'
do
describe
'Execute'
do
let
(
:irker
)
{
IrkerService
.
new
}
let
(
:irker
)
{
IrkerService
.
new
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:sample_data
)
do
let
(
:sample_data
)
do
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
end
end
...
...
spec/models/project_services/jira_service_spec.rb
View file @
fcb37542
...
@@ -71,7 +71,7 @@ describe JiraService, models: true do
...
@@ -71,7 +71,7 @@ describe JiraService, models: true do
describe
'#close_issue'
do
describe
'#close_issue'
do
let
(
:custom_base_url
)
{
'http://custom_url'
}
let
(
:custom_base_url
)
{
'http://custom_url'
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
before
do
before
do
...
@@ -207,12 +207,12 @@ describe JiraService, models: true do
...
@@ -207,12 +207,12 @@ describe JiraService, models: true do
end
end
describe
"Stored password invalidation"
do
describe
"Stored password invalidation"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
"when a password was previously set"
do
context
"when a password was previously set"
do
before
do
before
do
@jira_service
=
JiraService
.
create!
(
@jira_service
=
JiraService
.
create!
(
project:
create
(
:project
)
,
project:
project
,
properties:
{
properties:
{
url:
'http://jira.example.com/rest/api/2'
,
url:
'http://jira.example.com/rest/api/2'
,
username:
'mic'
,
username:
'mic'
,
...
@@ -252,7 +252,7 @@ describe JiraService, models: true do
...
@@ -252,7 +252,7 @@ describe JiraService, models: true do
context
"when no password was previously set"
do
context
"when no password was previously set"
do
before
do
before
do
@jira_service
=
JiraService
.
create
(
@jira_service
=
JiraService
.
create
(
project:
create
(
:project
)
,
project:
project
,
properties:
{
properties:
{
url:
'http://jira.example.com/rest/api/2'
,
url:
'http://jira.example.com/rest/api/2'
,
username:
'mic'
username:
'mic'
...
@@ -281,7 +281,7 @@ describe JiraService, models: true do
...
@@ -281,7 +281,7 @@ describe JiraService, models: true do
end
end
describe
'description and title'
do
describe
'description and title'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'when it is not set'
do
context
'when it is not set'
do
before
do
before
do
...
@@ -316,7 +316,7 @@ describe JiraService, models: true do
...
@@ -316,7 +316,7 @@ describe JiraService, models: true do
end
end
describe
'project and issue urls'
do
describe
'project and issue urls'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'when gitlab.yml was initialized'
do
context
'when gitlab.yml was initialized'
do
before
do
before
do
...
...
spec/models/project_services/pipeline_email_service_spec.rb
View file @
fcb37542
...
@@ -7,7 +7,7 @@ describe PipelinesEmailService do
...
@@ -7,7 +7,7 @@ describe PipelinesEmailService do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
(
'master'
).
sha
)
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
(
'master'
).
sha
)
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:recipient
)
{
'test@gitlab.com'
}
let
(
:recipient
)
{
'test@gitlab.com'
}
let
(
:data
)
do
let
(
:data
)
do
...
...
spec/models/project_services/pushover_service_spec.rb
View file @
fcb37542
...
@@ -27,7 +27,7 @@ describe PushoverService, models: true do
...
@@ -27,7 +27,7 @@ describe PushoverService, models: true do
describe
'Execute'
do
describe
'Execute'
do
let
(
:pushover
)
{
PushoverService
.
new
}
let
(
:pushover
)
{
PushoverService
.
new
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:sample_data
)
do
let
(
:sample_data
)
do
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
end
end
...
...
spec/models/project_team_spec.rb
View file @
fcb37542
...
@@ -265,10 +265,10 @@ describe ProjectTeam, models: true do
...
@@ -265,10 +265,10 @@ describe ProjectTeam, models: true do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:personal_project
)
{
create
(
:project
,
namespace:
developer
.
namespace
)
}
let
(
:personal_project
)
{
create
(
:
empty_
project
,
namespace:
developer
.
namespace
)
}
let
(
:group_project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:group_project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
let
(
:members_project
)
{
create
(
:project
)
}
let
(
:members_project
)
{
create
(
:
empty_
project
)
}
let
(
:shared_project
)
{
create
(
:project
)
}
let
(
:shared_project
)
{
create
(
:
empty_
project
)
}
before
do
before
do
group
.
add_master
(
master
)
group
.
add_master
(
master
)
...
@@ -330,7 +330,7 @@ describe ProjectTeam, models: true do
...
@@ -330,7 +330,7 @@ describe ProjectTeam, models: true do
reporter
=
create
(
:user
)
reporter
=
create
(
:user
)
promoted_guest
=
create
(
:user
)
promoted_guest
=
create
(
:user
)
guest
=
create
(
:user
)
guest
=
create
(
:user
)
project
=
create
(
:project
)
project
=
create
(
:
empty_
project
)
project
.
add_master
(
master
)
project
.
add_master
(
master
)
project
.
add_reporter
(
reporter
)
project
.
add_reporter
(
reporter
)
...
...
spec/models/repository_spec.rb
View file @
fcb37542
...
@@ -4,7 +4,7 @@ describe Repository, models: true do
...
@@ -4,7 +4,7 @@ describe Repository, models: true do
include
RepoHelpers
include
RepoHelpers
TestBlob
=
Struct
.
new
(
:name
)
TestBlob
=
Struct
.
new
(
:name
)
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/models/service_spec.rb
View file @
fcb37542
...
@@ -12,7 +12,7 @@ describe Service, models: true do
...
@@ -12,7 +12,7 @@ describe Service, models: true do
end
end
describe
"Testable"
do
describe
"Testable"
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
allow
(
@service
).
to
receive
(
:project
).
and_return
(
project
)
allow
(
@service
).
to
receive
(
:project
).
and_return
(
project
)
...
@@ -35,7 +35,7 @@ describe Service, models: true do
...
@@ -35,7 +35,7 @@ describe Service, models: true do
end
end
describe
"With commits"
do
describe
"With commits"
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
allow
(
@service
).
to
receive
(
:project
).
and_return
(
project
)
allow
(
@service
).
to
receive
(
:project
).
and_return
(
project
)
...
@@ -60,7 +60,7 @@ describe Service, models: true do
...
@@ -60,7 +60,7 @@ describe Service, models: true do
api_key:
'123456789'
api_key:
'123456789'
})
})
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
describe
'is prefilled for projects pushover service'
do
describe
'is prefilled for projects pushover service'
do
it
"has all fields prefilled"
do
it
"has all fields prefilled"
do
...
@@ -79,7 +79,7 @@ describe Service, models: true do
...
@@ -79,7 +79,7 @@ describe Service, models: true do
describe
"{property}_changed?"
do
describe
"{property}_changed?"
do
let
(
:service
)
do
let
(
:service
)
do
BambooService
.
create
(
BambooService
.
create
(
project:
create
(
:project
),
project:
create
(
:
empty_
project
),
properties:
{
properties:
{
bamboo_url:
'http://gitlab.com'
,
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
username:
'mic'
,
...
@@ -119,7 +119,7 @@ describe Service, models: true do
...
@@ -119,7 +119,7 @@ describe Service, models: true do
describe
"{property}_touched?"
do
describe
"{property}_touched?"
do
let
(
:service
)
do
let
(
:service
)
do
BambooService
.
create
(
BambooService
.
create
(
project:
create
(
:project
),
project:
create
(
:
empty_
project
),
properties:
{
properties:
{
bamboo_url:
'http://gitlab.com'
,
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
username:
'mic'
,
...
@@ -159,7 +159,7 @@ describe Service, models: true do
...
@@ -159,7 +159,7 @@ describe Service, models: true do
describe
"{property}_was"
do
describe
"{property}_was"
do
let
(
:service
)
do
let
(
:service
)
do
BambooService
.
create
(
BambooService
.
create
(
project:
create
(
:project
),
project:
create
(
:
empty_
project
),
properties:
{
properties:
{
bamboo_url:
'http://gitlab.com'
,
bamboo_url:
'http://gitlab.com'
,
username:
'mic'
,
username:
'mic'
,
...
@@ -199,7 +199,7 @@ describe Service, models: true do
...
@@ -199,7 +199,7 @@ describe Service, models: true do
describe
'initialize service with no properties'
do
describe
'initialize service with no properties'
do
let
(
:service
)
do
let
(
:service
)
do
GitlabIssueTrackerService
.
create
(
GitlabIssueTrackerService
.
create
(
project:
create
(
:project
),
project:
create
(
:
empty_
project
),
title:
'random title'
title:
'random title'
)
)
end
end
...
@@ -214,7 +214,7 @@ describe Service, models: true do
...
@@ -214,7 +214,7 @@ describe Service, models: true do
end
end
describe
"callbacks"
do
describe
"callbacks"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let!
(
:service
)
do
let!
(
:service
)
do
RedmineService
.
new
(
RedmineService
.
new
(
project:
project
,
project:
project
,
...
...
spec/models/snippet_spec.rb
View file @
fcb37542
...
@@ -42,7 +42,7 @@ describe Snippet, models: true do
...
@@ -42,7 +42,7 @@ describe Snippet, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:
empty_
project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
snippet
.
to_reference
(
another_project
)).
to
eq
"sample-project$1"
expect
(
snippet
.
to_reference
(
another_project
)).
to
eq
"sample-project$1"
end
end
end
end
...
@@ -55,7 +55,7 @@ describe Snippet, models: true do
...
@@ -55,7 +55,7 @@ describe Snippet, models: true do
end
end
it
'still returns shortest reference when project arg present'
do
it
'still returns shortest reference when project arg present'
do
another_project
=
build
(
:project
,
name:
'another-project'
)
another_project
=
build
(
:
empty_
project
,
name:
'another-project'
)
expect
(
snippet
.
to_reference
(
another_project
)).
to
eq
"$1"
expect
(
snippet
.
to_reference
(
another_project
)).
to
eq
"$1"
end
end
end
end
...
@@ -173,7 +173,7 @@ describe Snippet, models: true do
...
@@ -173,7 +173,7 @@ describe Snippet, models: true do
end
end
describe
'#participants'
do
describe
'#participants'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:snippet
)
{
create
(
:snippet
,
content:
'foo'
,
project:
project
)
}
let
(
:snippet
)
{
create
(
:snippet
,
content:
'foo'
,
project:
project
)
}
let!
(
:note1
)
do
let!
(
:note1
)
do
...
...
spec/models/todo_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Todo
,
models:
true
do
describe
Todo
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:issue
)
{
create
(
:issue
)
}
let
(
:issue
)
{
create
(
:issue
)
}
describe
'relationships'
do
describe
'relationships'
do
...
@@ -82,6 +80,9 @@ describe Todo, models: true do
...
@@ -82,6 +80,9 @@ describe Todo, models: true do
describe
'#target'
do
describe
'#target'
do
context
'for commits'
do
context
'for commits'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
it
'returns an instance of Commit when exists'
do
it
'returns an instance of Commit when exists'
do
subject
.
project
=
project
subject
.
project
=
project
subject
.
target_type
=
'Commit'
subject
.
target_type
=
'Commit'
...
@@ -109,6 +110,9 @@ describe Todo, models: true do
...
@@ -109,6 +110,9 @@ describe Todo, models: true do
describe
'#target_reference'
do
describe
'#target_reference'
do
it
'returns the short commit id for commits'
do
it
'returns the short commit id for commits'
do
project
=
create
(
:project
,
:repository
)
commit
=
project
.
commit
subject
.
project
=
project
subject
.
project
=
project
subject
.
target_type
=
'Commit'
subject
.
target_type
=
'Commit'
subject
.
commit_id
=
commit
.
id
subject
.
commit_id
=
commit
.
id
...
...
spec/models/tree_spec.rb
View file @
fcb37542
require
'spec_helper'
require
'spec_helper'
describe
Tree
,
models:
true
do
describe
Tree
,
models:
true
do
let
(
:repository
)
{
create
(
:project
).
repository
}
let
(
:repository
)
{
create
(
:project
,
:repository
).
repository
}
let
(
:sha
)
{
repository
.
root_ref
}
let
(
:sha
)
{
repository
.
root_ref
}
subject
{
described_class
.
new
(
repository
,
'54fcc214'
)
}
subject
{
described_class
.
new
(
repository
,
'54fcc214'
)
}
...
...
spec/models/user_spec.rb
View file @
fcb37542
...
@@ -1382,14 +1382,14 @@ describe User, models: true do
...
@@ -1382,14 +1382,14 @@ describe User, models: true do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
let!
(
:nested_project
)
{
create
(
:project
,
namespace:
nested_group
)
}
let!
(
:nested_project
)
{
create
(
:
empty_
project
,
namespace:
nested_group
)
}
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
# Add more data to ensure method does not include wrong projects
# Add more data to ensure method does not include wrong projects
other_project
=
create
(
:project
,
namespace:
create
(
:group
,
:nested
))
other_project
=
create
(
:
empty_
project
,
namespace:
create
(
:group
,
:nested
))
other_project
.
add_developer
(
create
(
:user
))
other_project
.
add_developer
(
create
(
:user
))
end
end
...
...
spec/support/cycle_analytics_helpers/test_generation.rb
View file @
fcb37542
...
@@ -54,7 +54,7 @@ module CycleAnalyticsHelpers
...
@@ -54,7 +54,7 @@ module CycleAnalyticsHelpers
end
end
context
"when the data belongs to another project"
do
context
"when the data belongs to another project"
do
let
(
:other_project
)
{
create
(
:project
)
}
let
(
:other_project
)
{
create
(
:project
,
:repository
)
}
it
"returns nil"
do
it
"returns nil"
do
# Use a stub to "trick" the data/condition functions
# Use a stub to "trick" the data/condition functions
...
...
spec/support/mentionable_shared_examples.rb
View file @
fcb37542
...
@@ -12,7 +12,7 @@ shared_context 'mentionable context' do
...
@@ -12,7 +12,7 @@ shared_context 'mentionable context' do
let!
(
:mentioned_mr
)
{
create
(
:merge_request
,
source_project:
project
)
}
let!
(
:mentioned_mr
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:mentioned_commit
)
{
project
.
commit
(
"HEAD~1"
)
}
let
(
:mentioned_commit
)
{
project
.
commit
(
"HEAD~1"
)
}
let
(
:ext_proj
)
{
create
(
:project
,
:public
)
}
let
(
:ext_proj
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:ext_issue
)
{
create
(
:issue
,
project:
ext_proj
)
}
let
(
:ext_issue
)
{
create
(
:issue
,
project:
ext_proj
)
}
let
(
:ext_mr
)
{
create
(
:merge_request
,
:simple
,
source_project:
ext_proj
)
}
let
(
:ext_mr
)
{
create
(
:merge_request
,
:simple
,
source_project:
ext_proj
)
}
let
(
:ext_commit
)
{
ext_proj
.
commit
(
"HEAD~2"
)
}
let
(
:ext_commit
)
{
ext_proj
.
commit
(
"HEAD~2"
)
}
...
...
spec/support/slack_mattermost_notifications_shared_examples.rb
View file @
fcb37542
...
@@ -26,7 +26,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
...
@@ -26,7 +26,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
describe
"#execute"
do
describe
"#execute"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:username
)
{
'slack_username'
}
let
(
:username
)
{
'slack_username'
}
let
(
:channel
)
{
'slack_channel'
}
let
(
:channel
)
{
'slack_channel'
}
...
@@ -196,7 +196,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
...
@@ -196,7 +196,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
describe
"Note events"
do
describe
"Note events"
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
before
do
before
do
allow
(
chat_service
).
to
receive_messages
(
allow
(
chat_service
).
to
receive_messages
(
...
@@ -269,7 +269,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
...
@@ -269,7 +269,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do
describe
'Pipeline events'
do
describe
'Pipeline events'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
create
(
:ci_pipeline
,
...
...
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