Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-12-15 13:23:11 +0300
committerSean McGivern <sean@gitlab.com>2017-12-15 13:23:11 +0300
commit10885edf227bb6de865c73914783f2709ebae177 (patch)
treeabd08be1511d19ad1c67d4e08775c515a90571f2 /spec/features/help_pages_spec.rb
parent391bb437611b91e2767384ff9852beb573c84996 (diff)
Don't use Markdown cache for stubbed settings in specs
The ApplicationSetting model uses the CacheMarkdownField concern, which updates the cached HTML when the field is updated in the database. However, in specs, when we want to test conditions using ApplicationSetting, we stub it, because this is accessed in different ways throughout the application. This means that if a spec runs that caches one of the Markdown fields, and a later spec uses `stub_application_setting` to set the raw value of that field, the cached value was still the original one. We can work around this by ignoring the Markdown cache in contexts where we're using `stub_application_setting`. We could be smarter, and only do this on the Markdown fields of the model, but this is probably fine.
Diffstat (limited to 'spec/features/help_pages_spec.rb')
-rw-r--r--spec/features/help_pages_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/features/help_pages_spec.rb b/spec/features/help_pages_spec.rb
index 93be3b066ee..ab896a310be 100644
--- a/spec/features/help_pages_spec.rb
+++ b/spec/features/help_pages_spec.rb
@@ -37,7 +37,7 @@ describe 'Help Pages' do
context 'in a production environment with version check enabled', :js do
before do
allow(Rails.env).to receive(:production?) { true }
- allow_any_instance_of(ApplicationSetting).to receive(:version_check_enabled) { true }
+ stub_application_setting(version_check_enabled: true)
allow_any_instance_of(VersionCheck).to receive(:url) { '/version-check-url' }
sign_in(create(:user))
@@ -56,9 +56,9 @@ describe 'Help Pages' do
describe 'when help page is customized' do
before do
- allow_any_instance_of(ApplicationSetting).to receive(:help_page_hide_commercial_content?) { true }
- allow_any_instance_of(ApplicationSetting).to receive(:help_page_text) { "My Custom Text" }
- allow_any_instance_of(ApplicationSetting).to receive(:help_page_support_url) { "http://example.com/help" }
+ stub_application_setting(help_page_hide_commercial_content: true,
+ help_page_text: 'My Custom Text',
+ help_page_support_url: 'http://example.com/help')
sign_in(create(:user))
visit help_path