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:
Diffstat (limited to 'spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb52
1 files changed, 42 insertions, 10 deletions
diff --git a/spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb
index a7ba7a8ad07..639eb3f2b99 100644
--- a/spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_views_wiki_sidebar_shared_examples.rb
@@ -17,23 +17,55 @@ RSpec.shared_examples 'User views wiki sidebar' do
create(:wiki_page, wiki: wiki, title: 'another', content: 'another')
end
- it 'renders a default sidebar when there is no customized sidebar' do
- visit wiki_path(wiki)
+ context 'when there is no custom sidebar' do
+ before do
+ visit wiki_path(wiki)
+ end
- expect(page).to have_content('another')
- expect(page).not_to have_link('View All Pages')
+ it 'renders a default sidebar' do
+ within('.right-sidebar') do
+ expect(page).to have_content('another')
+ expect(page).not_to have_link('View All Pages')
+ end
+ end
+
+ it 'can create a custom sidebar', :js do
+ click_on 'Edit sidebar'
+ fill_in :wiki_content, with: 'My custom sidebar'
+ click_on 'Create page'
+
+ within('.right-sidebar') do
+ expect(page).to have_content('My custom sidebar')
+ expect(page).not_to have_content('another')
+ end
+ end
end
- context 'when there is a customized sidebar' do
+ context 'when there is a custom sidebar' do
before do
- create(:wiki_page, wiki: wiki, title: '_sidebar', content: 'My customized sidebar')
- end
+ create(:wiki_page, wiki: wiki, title: '_sidebar', content: 'My custom sidebar')
- it 'renders my customized sidebar instead of the default one' do
visit wiki_path(wiki)
+ end
+
+ it 'renders the custom sidebar instead of the default one' do
+ within('.right-sidebar') do
+ expect(page).to have_content('My custom sidebar')
+ expect(page).not_to have_content('another')
+ end
+ end
+
+ it 'can edit the custom sidebar', :js do
+ click_on 'Edit sidebar'
+
+ expect(page).to have_field(:wiki_content, with: 'My custom sidebar')
+
+ fill_in :wiki_content, with: 'My other custom sidebar'
+ click_on 'Save changes'
- expect(page).to have_content('My customized sidebar')
- expect(page).not_to have_content('Another')
+ within('.right-sidebar') do
+ expect(page).to have_content('My other custom sidebar')
+ end
end
end
end