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
271a6d1b
Commit
271a6d1b
authored
Jul 23, 2019
by
Jeremy Jackson
Committed by
jejacks0n
Jul 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolves confusion within spec rake tasks
parent
d892e80b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
62 deletions
+6
-62
lib/quality/test_level.rb
lib/quality/test_level.rb
+1
-0
lib/tasks/spec.rake
lib/tasks/spec.rake
+3
-60
spec/lib/quality/test_level_spec.rb
spec/lib/quality/test_level_spec.rb
+2
-2
No files found.
lib/quality/test_level.rb
View file @
271a6d1b
...
...
@@ -14,6 +14,7 @@ module Quality
finders
frontend
graphql
haml_lint
helpers
initializers
javascripts
...
...
lib/tasks/spec.rake
View file @
271a6d1b
...
...
@@ -2,8 +2,6 @@
return
if
Rails
.
env
.
production?
Rake
::
Task
[
"spec"
].
clear
if
Rake
::
Task
.
task_defined?
(
'spec'
)
namespace
:spec
do
desc
'GitLab | RSpec | Run unit tests'
RSpec
::
Core
::
RakeTask
.
new
(
:unit
,
:rspec_opts
)
do
|
t
,
args
|
...
...
@@ -26,63 +24,8 @@ namespace :spec do
t
.
rspec_opts
=
args
[
:rspec_opts
]
end
desc
'[Deprecated] Use the "bin/rspec --tag api" instead'
task
:api
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec --tag @api)
]
run_commands
(
cmds
)
end
desc
'[Deprecated] Use the "spec:system" task instead'
task
:feature
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec --tag @feature)
]
run_commands
(
cmds
)
end
desc
'[Deprecated] Use "bin/rspec spec/models" instead'
task
:models
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec --tag @models)
]
run_commands
(
cmds
)
end
desc
'[Deprecated] Use "bin/rspec spec/services" instead'
task
:services
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec --tag @services)
]
run_commands
(
cmds
)
end
desc
'[Deprecated] Use "bin/rspec spec/lib" instead'
task
:lib
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec --tag @lib)
]
run_commands
(
cmds
)
end
end
desc
"GitLab | Run specs"
task
:spec
do
cmds
=
[
%w(rake gitlab:setup)
,
%w(rspec spec)
]
run_commands
(
cmds
)
end
def
run_commands
(
cmds
)
cmds
.
each
do
|
cmd
|
system
({
'RAILS_ENV'
=>
'test'
,
'force'
=>
'yes'
},
*
cmd
)
||
raise
(
"
#{
cmd
}
failed!"
)
desc
'Run the code examples in spec/requests/api'
RSpec
::
Core
::
RakeTask
.
new
(
:api
)
do
|
t
|
t
.
pattern
=
'spec/requests/api/**/*_spec.rb'
end
end
spec/lib/quality/test_level_spec.rb
View file @
271a6d1b
...
...
@@ -7,7 +7,7 @@ RSpec.describe Quality::TestLevel do
context
'when level is unit'
do
it
'returns a pattern'
do
expect
(
subject
.
pattern
(
:unit
))
.
to
eq
(
"spec/{bin,config,db,dependencies,factories,finders,frontend,graphql,helpers,initializers,javascripts,lib,migrations,models,policies,presenters,rack_servers,routing,rubocop,serializers,services,sidekiq,tasks,uploaders,validators,views,workers,elastic_integration}{,/**/}*_spec.rb"
)
.
to
eq
(
"spec/{bin,config,db,dependencies,factories,finders,frontend,graphql,h
aml_lint,h
elpers,initializers,javascripts,lib,migrations,models,policies,presenters,rack_servers,routing,rubocop,serializers,services,sidekiq,tasks,uploaders,validators,views,workers,elastic_integration}{,/**/}*_spec.rb"
)
end
end
...
...
@@ -47,7 +47,7 @@ RSpec.describe Quality::TestLevel do
context
'when level is unit'
do
it
'returns a regexp'
do
expect
(
subject
.
regexp
(
:unit
))
.
to
eq
(
%r{spec/(bin|config|db|dependencies|factories|finders|frontend|graphql|helpers|initializers|javascripts|lib|migrations|models|policies|presenters|rack_servers|routing|rubocop|serializers|services|sidekiq|tasks|uploaders|validators|views|workers|elastic_integration)}
)
.
to
eq
(
%r{spec/(bin|config|db|dependencies|factories|finders|frontend|graphql|h
aml_lint|h
elpers|initializers|javascripts|lib|migrations|models|policies|presenters|rack_servers|routing|rubocop|serializers|services|sidekiq|tasks|uploaders|validators|views|workers|elastic_integration)}
)
end
end
...
...
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