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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
80ab6b61
Commit
80ab6b61
authored
Sep 03, 2020
by
Rajendra Kadam
Committed by
Rémy Coutable
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RSpec/LetBeforeExamples cop
Fixes the cop for the files Adds changelog for the change
parent
146c43c9
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
116 additions
and
129 deletions
+116
-129
.rubocop_todo.yml
.rubocop_todo.yml
+0
-15
changelogs/unreleased/let-before-examples-cop.yml
changelogs/unreleased/let-before-examples-cop.yml
+5
-0
spec/lib/banzai/filter/issue_reference_filter_spec.rb
spec/lib/banzai/filter/issue_reference_filter_spec.rb
+35
-35
spec/lib/banzai/filter/user_reference_filter_spec.rb
spec/lib/banzai/filter/user_reference_filter_spec.rb
+8
-8
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
+11
-11
spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb
...gitlab/email/handler/create_merge_request_handler_spec.rb
+12
-12
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
+10
-10
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+10
-13
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+5
-5
spec/models/project_services/packagist_service_spec.rb
spec/models/project_services/packagist_service_spec.rb
+14
-14
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
+2
-2
spec/serializers/pipeline_details_entity_spec.rb
spec/serializers/pipeline_details_entity_spec.rb
+4
-4
No files found.
.rubocop_todo.yml
View file @
80ab6b61
...
@@ -199,21 +199,6 @@ RSpec/ExpectChange:
...
@@ -199,21 +199,6 @@ RSpec/ExpectChange:
RSpec/ExpectInHook
:
RSpec/ExpectInHook
:
Enabled
:
false
Enabled
:
false
# Offense count: 68
# Cop supports --auto-correct.
RSpec/LetBeforeExamples
:
Exclude
:
-
'
spec/lib/banzai/filter/issue_reference_filter_spec.rb'
-
'
spec/lib/banzai/filter/user_reference_filter_spec.rb'
-
'
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb'
-
'
spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb'
-
'
spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
-
'
spec/models/commit_range_spec.rb'
-
'
spec/models/milestone_spec.rb'
-
'
spec/models/project_services/packagist_service_spec.rb'
-
'
spec/rubocop/cop/migration/update_column_in_batches_spec.rb'
-
'
spec/serializers/pipeline_details_entity_spec.rb'
# Offense count: 2188
# Offense count: 2188
# Cop supports --auto-correct.
# Cop supports --auto-correct.
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
...
...
changelogs/unreleased/let-before-examples-cop.yml
0 → 100644
View file @
80ab6b61
---
title
:
Fix RSpec/LetBeforeExamples cop
merge_request
:
41250
author
:
Rajendra Kadam
type
:
fixed
spec/lib/banzai/filter/issue_reference_filter_spec.rb
View file @
80ab6b61
...
@@ -40,10 +40,10 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -40,10 +40,10 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'internal reference'
do
context
'internal reference'
do
it_behaves_like
'a reference containing an element node'
let
(
:reference
)
{
"#
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"#
#{
issue
.
iid
}
"
}
it_behaves_like
'a reference containing an element node'
it
'links to a valid reference'
do
it
'links to a valid reference'
do
doc
=
reference_filter
(
"Fixed
#{
reference
}
"
)
doc
=
reference_filter
(
"Fixed
#{
reference
}
"
)
...
@@ -134,11 +134,11 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -134,11 +134,11 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project / cross-namespace complete reference'
do
context
'cross-project / cross-namespace complete reference'
do
it_behaves_like
'a reference containing an element node'
let
(
:project2
)
{
create
(
:project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
"
#{
project2
.
full_path
}
#
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"
#{
project2
.
full_path
}
#
#{
issue
.
iid
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
)
}
it_behaves_like
'a reference containing an element node'
it
'ignores valid references when cross-reference project uses external tracker'
do
it
'ignores valid references when cross-reference project uses external tracker'
do
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
...
@@ -182,13 +182,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -182,13 +182,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project / same-namespace complete reference'
do
context
'cross-project / same-namespace complete reference'
do
it_behaves_like
'a reference containing an element node'
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
"
#{
project2
.
full_path
}
#
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"
#{
project2
.
full_path
}
#
#{
issue
.
iid
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
)
}
it_behaves_like
'a reference containing an element node'
it
'ignores valid references when cross-reference project uses external tracker'
do
it
'ignores valid references when cross-reference project uses external tracker'
do
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
...
@@ -232,13 +232,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -232,13 +232,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project shorthand reference'
do
context
'cross-project shorthand reference'
do
it_behaves_like
'a reference containing an element node'
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
"
#{
project2
.
path
}
#
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"
#{
project2
.
path
}
#
#{
issue
.
iid
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
)
}
it_behaves_like
'a reference containing an element node'
it
'ignores valid references when cross-reference project uses external tracker'
do
it
'ignores valid references when cross-reference project uses external tracker'
do
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
expect_any_instance_of
(
described_class
).
to
receive
(
:find_object
)
...
@@ -282,12 +282,12 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -282,12 +282,12 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project URL reference'
do
context
'cross-project URL reference'
do
it_behaves_like
'a reference containing an element node'
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
issue_url
+
"#note_123"
}
let
(
:reference
)
{
issue_url
+
"#note_123"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
it_behaves_like
'a reference containing an element node'
it
'links to a valid reference'
do
it
'links to a valid reference'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
...
@@ -310,13 +310,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -310,13 +310,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project reference in link href'
do
context
'cross-project reference in link href'
do
it_behaves_like
'a reference containing an element node'
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
issue
.
to_reference
(
project
)
}
let
(
:reference_link
)
{
%{<a href="#{reference}">Reference</a>}
}
let
(
:reference_link
)
{
%{<a href="#{reference}">Reference</a>}
}
let
(
:reference
)
{
issue
.
to_reference
(
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
it_behaves_like
'a reference containing an element node'
it
'links to a valid reference'
do
it
'links to a valid reference'
do
doc
=
reference_filter
(
"See
#{
reference_link
}
"
)
doc
=
reference_filter
(
"See
#{
reference_link
}
"
)
...
@@ -339,13 +339,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
...
@@ -339,13 +339,13 @@ RSpec.describe Banzai::Filter::IssueReferenceFilter do
end
end
context
'cross-project URL in link href'
do
context
'cross-project URL in link href'
do
it_behaves_like
'a reference containing an element node'
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:reference
)
{
"
#{
issue_url
+
"#note_123"
}
"
}
let
(
:reference_link
)
{
%{<a href="#{reference}">Reference</a>}
}
let
(
:reference_link
)
{
%{<a href="#{reference}">Reference</a>}
}
let
(
:reference
)
{
"
#{
issue_url
+
"#note_123"
}
"
}
let
(
:issue
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
it_behaves_like
'a reference containing an element node'
it
'links to a valid reference'
do
it
'links to a valid reference'
do
doc
=
reference_filter
(
"See
#{
reference_link
}
"
)
doc
=
reference_filter
(
"See
#{
reference_link
}
"
)
...
...
spec/lib/banzai/filter/user_reference_filter_spec.rb
View file @
80ab6b61
...
@@ -40,10 +40,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
...
@@ -40,10 +40,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
end
end
context
'mentioning @all'
do
context
'mentioning @all'
do
it_behaves_like
'a reference containing an element node'
let
(
:reference
)
{
User
.
reference_prefix
+
'all'
}
let
(
:reference
)
{
User
.
reference_prefix
+
'all'
}
it_behaves_like
'a reference containing an element node'
before
do
before
do
project
.
add_developer
(
project
.
creator
)
project
.
add_developer
(
project
.
creator
)
end
end
...
@@ -78,10 +78,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
...
@@ -78,10 +78,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
end
end
context
'mentioning a group'
do
context
'mentioning a group'
do
it_behaves_like
'a reference containing an element node'
let
(
:group
)
{
create
(
:group
)
}
let
(
:reference
)
{
group
.
to_reference
}
let
(
:reference
)
{
group
.
to_reference
}
let
(
:group
)
{
create
(
:group
)
}
it_behaves_like
'a reference containing an element node'
it
'links to the Group'
do
it
'links to the Group'
do
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
...
@@ -98,10 +98,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
...
@@ -98,10 +98,10 @@ RSpec.describe Banzai::Filter::UserReferenceFilter do
end
end
context
'mentioning a nested group'
do
context
'mentioning a nested group'
do
it_behaves_like
'a reference containing an element node'
let
(
:group
)
{
create
(
:group
,
:nested
)
}
let
(
:reference
)
{
group
.
to_reference
}
let
(
:reference
)
{
group
.
to_reference
}
let
(
:group
)
{
create
(
:group
,
:nested
)
}
it_behaves_like
'a reference containing an element node'
it
'links to the nested group'
do
it
'links to the nested group'
do
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
...
...
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
View file @
80ab6b61
...
@@ -4,17 +4,6 @@ require 'spec_helper'
...
@@ -4,17 +4,6 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
do
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
do
include_context
:email_shared_context
include_context
:email_shared_context
it_behaves_like
:reply_processing_shared_examples
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"incoming+%{key}@appmail.adventuretime.ooo"
)
stub_config_setting
(
host:
'localhost'
)
end
let
(
:email_raw
)
{
email_fixture
(
'emails/valid_new_issue.eml'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
path:
'gitlabhq'
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
,
path:
'gitlabhq'
)
}
let!
(
:user
)
do
let!
(
:user
)
do
create
(
create
(
:user
,
:user
,
...
@@ -23,6 +12,17 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
...
@@ -23,6 +12,17 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
)
)
end
end
let!
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
,
path:
'gitlabhq'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
path:
'gitlabhq'
)
}
let
(
:email_raw
)
{
email_fixture
(
'emails/valid_new_issue.eml'
)
}
it_behaves_like
:reply_processing_shared_examples
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"incoming+%{key}@appmail.adventuretime.ooo"
)
stub_config_setting
(
host:
'localhost'
)
end
context
"when email key"
do
context
"when email key"
do
let
(
:mail
)
{
Mail
::
Message
.
new
(
email_raw
)
}
let
(
:mail
)
{
Mail
::
Message
.
new
(
email_raw
)
}
...
...
spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb
View file @
80ab6b61
...
@@ -4,6 +4,18 @@ require 'spec_helper'
...
@@ -4,6 +4,18 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateMergeRequestHandler
do
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateMergeRequestHandler
do
include_context
:email_shared_context
include_context
:email_shared_context
let!
(
:user
)
do
create
(
:user
,
email:
'jake@adventuretime.ooo'
,
incoming_email_token:
'auth_token'
)
end
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
,
path:
'gitlabhq'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
path:
'gitlabhq'
)
}
let
(
:email_raw
)
{
email_fixture
(
'emails/valid_new_merge_request.eml'
)
}
it_behaves_like
:reply_processing_shared_examples
it_behaves_like
:reply_processing_shared_examples
before
do
before
do
...
@@ -15,18 +27,6 @@ RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do
...
@@ -15,18 +27,6 @@ RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do
TestEnv
.
clean_test_path
TestEnv
.
clean_test_path
end
end
let
(
:email_raw
)
{
email_fixture
(
'emails/valid_new_merge_request.eml'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
path:
'gitlabhq'
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
,
path:
'gitlabhq'
)
}
let!
(
:user
)
do
create
(
:user
,
email:
'jake@adventuretime.ooo'
,
incoming_email_token:
'auth_token'
)
end
context
"when email key"
do
context
"when email key"
do
let
(
:mail
)
{
Mail
::
Message
.
new
(
email_raw
)
}
let
(
:mail
)
{
Mail
::
Message
.
new
(
email_raw
)
}
...
...
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
View file @
80ab6b61
...
@@ -4,6 +4,16 @@ require 'spec_helper'
...
@@ -4,6 +4,16 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateNoteHandler
do
RSpec
.
describe
Gitlab
::
Email
::
Handler
::
CreateNoteHandler
do
include_context
:email_shared_context
include_context
:email_shared_context
let!
(
:sent_notification
)
do
SentNotification
.
record_note
(
note
,
user
.
id
,
mail_key
)
end
let
(
:noteable
)
{
note
.
noteable
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
it_behaves_like
:reply_processing_shared_examples
it_behaves_like
:reply_processing_shared_examples
before
do
before
do
...
@@ -11,16 +21,6 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do
...
@@ -11,16 +21,6 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do
stub_config_setting
(
host:
'localhost'
)
stub_config_setting
(
host:
'localhost'
)
end
end
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
)
}
let
(
:noteable
)
{
note
.
noteable
}
let!
(
:sent_notification
)
do
SentNotification
.
record_note
(
note
,
user
.
id
,
mail_key
)
end
context
"when the recipient address doesn't include a mail key"
do
context
"when the recipient address doesn't include a mail key"
do
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
).
gsub
(
mail_key
,
""
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
).
gsub
(
mail_key
,
""
)
}
...
...
spec/models/commit_range_spec.rb
View file @
80ab6b61
...
@@ -3,25 +3,22 @@
...
@@ -3,25 +3,22 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
CommitRange
do
RSpec
.
describe
CommitRange
do
let
(
:range2
)
{
described_class
.
new
(
"
#{
sha_from
}
..
#{
sha_to
}
"
,
project
)
}
let
(
:range
)
{
described_class
.
new
(
"
#{
sha_from
}
...
#{
sha_to
}
"
,
project
)
}
let
(
:full_sha_to
)
{
commit2
.
id
}
let
(
:full_sha_from
)
{
commit1
.
id
}
let
(
:sha_to
)
{
commit2
.
short_id
}
let
(
:sha_from
)
{
commit1
.
short_id
}
let!
(
:commit2
)
{
project
.
commit
}
let!
(
:commit1
)
{
project
.
commit
(
"HEAD~2"
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
describe
'modules'
do
describe
'modules'
do
subject
{
described_class
}
subject
{
described_class
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
end
end
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let!
(
:commit1
)
{
project
.
commit
(
"HEAD~2"
)
}
let!
(
:commit2
)
{
project
.
commit
}
let
(
:sha_from
)
{
commit1
.
short_id
}
let
(
:sha_to
)
{
commit2
.
short_id
}
let
(
:full_sha_from
)
{
commit1
.
id
}
let
(
:full_sha_to
)
{
commit2
.
id
}
let
(
:range
)
{
described_class
.
new
(
"
#{
sha_from
}
...
#{
sha_to
}
"
,
project
)
}
let
(
:range2
)
{
described_class
.
new
(
"
#{
sha_from
}
..
#{
sha_to
}
"
,
project
)
}
it
'raises ArgumentError when given an invalid range string'
do
it
'raises ArgumentError when given an invalid range string'
do
expect
{
described_class
.
new
(
"Foo"
,
project
)
}.
to
raise_error
(
ArgumentError
)
expect
{
described_class
.
new
(
"Foo"
,
project
)
}.
to
raise_error
(
ArgumentError
)
end
end
...
...
spec/models/milestone_spec.rb
View file @
80ab6b61
...
@@ -3,6 +3,11 @@
...
@@ -3,6 +3,11 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Milestone
do
RSpec
.
describe
Milestone
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
it_behaves_like
'a timebox'
,
:milestone
it_behaves_like
'a timebox'
,
:milestone
describe
'MilestoneStruct#serializable_hash'
do
describe
'MilestoneStruct#serializable_hash'
do
...
@@ -47,11 +52,6 @@ RSpec.describe Milestone do
...
@@ -47,11 +52,6 @@ RSpec.describe Milestone do
it
{
is_expected
.
to
have_many
(
:milestone_releases
)
}
it
{
is_expected
.
to
have_many
(
:milestone_releases
)
}
end
end
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'.predefined_id?'
do
describe
'.predefined_id?'
do
it
'returns true for a predefined Milestone ID'
do
it
'returns true for a predefined Milestone ID'
do
expect
(
Milestone
.
predefined_id?
(
described_class
::
Upcoming
.
id
)).
to
be
true
expect
(
Milestone
.
predefined_id?
(
described_class
::
Upcoming
.
id
)).
to
be
true
...
...
spec/models/project_services/packagist_service_spec.rb
View file @
80ab6b61
...
@@ -3,20 +3,6 @@
...
@@ -3,20 +3,6 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
PackagistService
do
RSpec
.
describe
PackagistService
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:project
}
it
{
is_expected
.
to
have_one
:service_hook
}
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:packagist_server
)
{
'https://packagist.example.com'
}
let
(
:packagist_username
)
{
'theUser'
}
let
(
:packagist_token
)
{
'verySecret'
}
let
(
:packagist_hook_url
)
do
"
#{
packagist_server
}
/api/update-package?username=
#{
packagist_username
}
&apiToken=
#{
packagist_token
}
"
end
let
(
:packagist_params
)
do
let
(
:packagist_params
)
do
{
{
active:
true
,
active:
true
,
...
@@ -29,6 +15,20 @@ RSpec.describe PackagistService do
...
@@ -29,6 +15,20 @@ RSpec.describe PackagistService do
}
}
end
end
let
(
:packagist_hook_url
)
do
"
#{
packagist_server
}
/api/update-package?username=
#{
packagist_username
}
&apiToken=
#{
packagist_token
}
"
end
let
(
:packagist_token
)
{
'verySecret'
}
let
(
:packagist_username
)
{
'theUser'
}
let
(
:packagist_server
)
{
'https://packagist.example.com'
}
let
(
:project
)
{
create
(
:project
)
}
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:project
}
it
{
is_expected
.
to
have_one
:service_hook
}
end
describe
'#execute'
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
...
...
spec/rubocop/cop/migration/update_column_in_batches_spec.rb
View file @
80ab6b61
...
@@ -27,6 +27,8 @@ RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
...
@@ -27,6 +27,8 @@ RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
FileUtils
.
rm_rf
(
tmp_rails_root
)
FileUtils
.
rm_rf
(
tmp_rails_root
)
end
end
let
(
:spec_filepath
)
{
tmp_rails_root
.
join
(
'spec'
,
'migrations'
,
'my_super_migration_spec.rb'
)
}
context
'outside of a migration'
do
context
'outside of a migration'
do
it
'does not register any offenses'
do
it
'does not register any offenses'
do
inspect_source
(
migration_code
)
inspect_source
(
migration_code
)
...
@@ -35,8 +37,6 @@ RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
...
@@ -35,8 +37,6 @@ RSpec.describe RuboCop::Cop::Migration::UpdateColumnInBatches do
end
end
end
end
let
(
:spec_filepath
)
{
tmp_rails_root
.
join
(
'spec'
,
'migrations'
,
'my_super_migration_spec.rb'
)
}
shared_context
'with a migration file'
do
shared_context
'with a migration file'
do
before
do
before
do
FileUtils
.
mkdir_p
(
File
.
dirname
(
migration_filepath
))
FileUtils
.
mkdir_p
(
File
.
dirname
(
migration_filepath
))
...
...
spec/serializers/pipeline_details_entity_spec.rb
View file @
80ab6b61
...
@@ -6,6 +6,10 @@ RSpec.describe PipelineDetailsEntity do
...
@@ -6,6 +6,10 @@ RSpec.describe PipelineDetailsEntity do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:entity
)
do
described_class
.
represent
(
pipeline
,
request:
request
)
end
it
'inherrits from PipelineEntity'
do
it
'inherrits from PipelineEntity'
do
expect
(
described_class
).
to
be
<
PipelineEntity
expect
(
described_class
).
to
be
<
PipelineEntity
end
end
...
@@ -16,10 +20,6 @@ RSpec.describe PipelineDetailsEntity do
...
@@ -16,10 +20,6 @@ RSpec.describe PipelineDetailsEntity do
allow
(
request
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
request
).
to
receive
(
:current_user
).
and_return
(
user
)
end
end
let
(
:entity
)
do
described_class
.
represent
(
pipeline
,
request:
request
)
end
describe
'#as_json'
do
describe
'#as_json'
do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
...
...
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