BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d134c0fb
Commit
d134c0fb
authored
May 15, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs describing `fast_spec_helper` best practices
parent
e9cf1020
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
best_practices.md
doc/development/testing_guide/best_practices.md
+23
-4
No files found.
doc/development/testing_guide/best_practices.md
View file @
d134c0fb
...
@@ -134,11 +134,30 @@ really fast since:
...
@@ -134,11 +134,30 @@ really fast since:
-
gitlab-shell and Gitaly setup are skipped
-
gitlab-shell and Gitaly setup are skipped
-
Test repositories setup are skipped
-
Test repositories setup are skipped
Note that in some cases, you might have to add some
`require_dependency 'foo'`
`fast_spec_helper`
also support autoloading classes that are located inside the
in your file under test since Rails autoloading is not available in these cases.
`lib/`
directory. It means that as long as your class / module is using only
code from the
`lib/`
directory you will not need to explicitly load any
dependencies.
`fast_spec_helper`
also loads all ActiveSupport extensions,
including core extensions that are commonly used in the Rails environment.
This shouldn't be a problem since explicitely listing dependencies should be
Note that in some cases, you might still have to load some dependencies using
considered a good practice anyway.
`require_dependency`
in your
`*_spec.rb`
file, like when a code is using gems.
For example, if you want to test your code that is calling the
`Gitlab::UntrustedRegexp`
class, which under the hood uses
`re2`
library, you
should be able to define a test using follow code snippet.
```
ruby
require
'fast_spec_helper'
require_dependency
're2'
describe
Gitlab
::
MyModule
::
MyClass
do
# ...
end
```
It takes around one second to load tests that are using
`fast_spec_helper`
instead of 30+ seconds in case of a regular
`spec_helper`
.
### `let` variables
### `let` variables
...
...
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