diff options
Diffstat (limited to 'spec/features/projects/blobs/edit_spec.rb')
-rw-r--r-- | spec/features/projects/blobs/edit_spec.rb | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 6e335871ed1..7474f416146 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -83,29 +83,20 @@ RSpec.describe 'Editing file blob', :js, feature_category: :projects do end context 'blob edit toolbar' do - toolbar_buttons = [ - "Add bold text", - "Add italic text", - "Add strikethrough text", - "Insert a quote", - "Insert code", - "Add a link", - "Add a bullet list", - "Add a numbered list", - "Add a checklist", - "Add a collapsible section", - "Add a table" - ] - - it "does not have any buttons" do - stub_feature_flags(source_editor_toolbar: true) - visit project_edit_blob_path(project, tree_join(branch, readme_file_path)) - buttons = page.all('.file-buttons .md-header-toolbar button[type="button"]') - expect(buttons.length).to eq(0) - end - - it "has defined set of toolbar buttons when the flag is off" do - stub_feature_flags(source_editor_toolbar: false) + def has_toolbar_buttons + toolbar_buttons = [ + "Add bold text", + "Add italic text", + "Add strikethrough text", + "Insert a quote", + "Insert code", + "Add a link", + "Add a bullet list", + "Add a numbered list", + "Add a checklist", + "Add a collapsible section", + "Add a table" + ] visit project_edit_blob_path(project, tree_join(branch, readme_file_path)) buttons = page.all('.file-buttons .md-header-toolbar button[type="button"]') expect(buttons.length).to eq(toolbar_buttons.length) @@ -113,6 +104,16 @@ RSpec.describe 'Editing file blob', :js, feature_category: :projects do expect(buttons[i]['title']).to include(button_title) end end + + it "has defined set of toolbar buttons when the flag is on" do + stub_feature_flags(source_editor_toolbar: true) + has_toolbar_buttons + end + + it "has defined set of toolbar buttons when the flag is off" do + stub_feature_flags(source_editor_toolbar: false) + has_toolbar_buttons + end end context 'from blob file path' do |