diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-23 11:48:53 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-23 11:48:53 +0000 |
commit | 05c66406ca7e7f29b9b210fda9f31a60528917f1 (patch) | |
tree | 18d7f553a61fea3c6a9655be16a4842478990284 /doc/development/testing.md | |
parent | 0f36cfd7f58977becea9d3ecf410d3669440fbe9 (diff) | |
parent | f106ad513546c8d77b88a0a061a0b6a7e7ee26ed (diff) | |
download | gitlab-ce-26900-pipelines-tabs.tar.gz |
Merge branch 'master' into 26900-pipelines-tabs26900-pipelines-tabs
* master: (361 commits)
Code style improvements
remove require.context from network_bundle
remove require.context from graphs_bundle
remove require.context from filtered_search_bundle
Ignore two Rails CVEs in bundler:audit job
Remove Pages readme
Change Pages redirect
Add missing index.md to Pages docs
Added double newline after file upload markdown insert
Reorder main index items in Pages overview
remove html comments
remove <>
wrapping text - part 3
wrapping text - part 2 [ci skip]
fix link
wrap text - part 1 - [ci skip]
typo
fix spelling, add intermediate cert link
Improve `Gitlab::EeCompatCheck` by using the `git apply --3way` flag
remove link to unfinished video
...
Diffstat (limited to 'doc/development/testing.md')
-rw-r--r-- | doc/development/testing.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/development/testing.md b/doc/development/testing.md index 761847b2bab..9b545d7f0f1 100644 --- a/doc/development/testing.md +++ b/doc/development/testing.md @@ -95,6 +95,25 @@ so we need to set some guidelines for their use going forward: [lets-not]: https://robots.thoughtbot.com/lets-not +### Time-sensitive tests + +[Timecop](https://github.com/travisjeffery/timecop) is available in our +Ruby-based tests for verifying things that are time-sensitive. Any test that +exercises or verifies something time-sensitive should make use of Timecop to +prevent transient test failures. + +Example: + +```ruby +it 'is overdue' do + issue = build(:issue, due_date: Date.tomorrow) + + Timecop.freeze(3.days.from_now) do + expect(issue).to be_overdue + end +end +``` + ### Test speed GitLab has a massive test suite that, without parallelization, can take more @@ -115,6 +134,10 @@ Here are some things to keep in mind regarding test performance: ### Features / Integration +GitLab uses [rspec-rails feature specs] to test features in a browser +environment. These are [capybara] specs running on the headless [poltergeist] +driver. + - Feature specs live in `spec/features/` and should be named `ROLE_ACTION_spec.rb`, such as `user_changes_password_spec.rb`. - Use only one `feature` block per feature spec file. @@ -122,6 +145,10 @@ Here are some things to keep in mind regarding test performance: - Avoid scenario titles that add no information, such as "successfully." - Avoid scenario titles that repeat the feature title. +[rspec-rails feature specs]: https://github.com/rspec/rspec-rails#feature-specs +[capybara]: https://github.com/teamcapybara/capybara +[poltergeist]: https://github.com/teampoltergeist/poltergeist + ## Spinach (feature) tests GitLab [moved from Cucumber to Spinach](https://github.com/gitlabhq/gitlabhq/pull/1426) |