BigW Consortium Gitlab

Simplify specs by not over-expecting

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 3811eb0b
...@@ -15,7 +15,7 @@ v 8.8.0 (unreleased) ...@@ -15,7 +15,7 @@ v 8.8.0 (unreleased)
- Files over 5MB can only be viewed in their raw form, files over 1MB without highlighting !3718 - Files over 5MB can only be viewed in their raw form, files over 1MB without highlighting !3718
- Add support for supressing text diffs using .gitattributes on the default branch (Matt Oakes) - Add support for supressing text diffs using .gitattributes on the default branch (Matt Oakes)
v 8.7.2 (unreleased) v 8.7.2
- The "New Branch" button is now loaded asynchronously - The "New Branch" button is now loaded asynchronously
- Fix error 500 when trying to create a wiki page - Fix error 500 when trying to create a wiki page
......
...@@ -11,17 +11,16 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -11,17 +11,16 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
click_link 'Wiki' click_link 'Wiki'
end end
context 'wiki project is in the user namespace' do context 'in the user namespace' do
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
context 'when wiki is empty' do context 'when wiki is empty' do
scenario 'user can create a new wiki page from the wiki home page' do scenario 'directly from the wiki home page' do
expect(page).to have_content('Home · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
expect(page).to have_content("Home · last edited by #{user.name}") expect(page).to have_content('Home')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
...@@ -31,34 +30,32 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -31,34 +30,32 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute
end end
scenario 'user can create a new wiki page', js: true do scenario 'via the "new wiki page" page', js: true do
click_link 'New Page' click_link 'New Page'
fill_in :new_wiki_path, with: 'foo' fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page' click_button 'Create Page'
expect(page).to have_content('Foo · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
expect(page).to have_content("Foo · last edited by #{user.name}") expect(page).to have_content('Foo')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
end end
context 'wiki project is in the user namespace' do context 'in a group namespace' do
let(:project) { create(:project, namespace: create(:group, :public)) } let(:project) { create(:project, namespace: create(:group, :public)) }
context 'when wiki is empty' do context 'when wiki is empty' do
scenario 'user can create a new wiki page from the wiki home page' do scenario 'directly from the wiki home page' do
expect(page).to have_content('Home · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
expect(page).to have_content("Home · last edited by #{user.name}") expect(page).to have_content('Home')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
...@@ -68,18 +65,17 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do ...@@ -68,18 +65,17 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do
WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute
end end
scenario 'user can create a new wiki page', js: true do scenario 'via the "new wiki page" page', js: true do
click_link 'New Page' click_link 'New Page'
fill_in :new_wiki_path, with: 'foo' fill_in :new_wiki_path, with: 'foo'
click_button 'Create Page' click_button 'Create Page'
expect(page).to have_content('Foo · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Create page' click_button 'Create page'
expect(page).to have_content("Foo · last edited by #{user.name}") expect(page).to have_content('Foo')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
......
...@@ -12,34 +12,32 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do ...@@ -12,34 +12,32 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do
click_link 'Wiki' click_link 'Wiki'
end end
context 'wiki project is in the user namespace' do context 'in the user namespace' do
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
scenario 'user can update the wiki home page' do scenario 'the home page' do
click_link 'Edit' click_link 'Edit'
expect(page).to have_content('Home · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes' click_button 'Save changes'
expect(page).to have_content("Home · last edited by #{user.name}") expect(page).to have_content('Home')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
context 'wiki project is in the user namespace' do context 'in a group namespace' do
let(:project) { create(:project, namespace: create(:group, :public)) } let(:project) { create(:project, namespace: create(:group, :public)) }
scenario 'user can update the wiki home page' do scenario 'the home page' do
click_link 'Edit' click_link 'Edit'
expect(page).to have_content('Home · Edit Page')
fill_in :wiki_content, with: 'My awesome wiki!' fill_in :wiki_content, with: 'My awesome wiki!'
click_button 'Save changes' click_button 'Save changes'
expect(page).to have_content("Home · last edited by #{user.name}") expect(page).to have_content('Home')
expect(page).to have_content("last edited by #{user.name}")
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment