diff options
author | Rémy Coutable <remy@rymai.me> | 2016-05-02 18:49:51 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-02 19:34:14 +0300 |
commit | f1e74de47cd9fcf334617023aaa737c83c98a7f2 (patch) | |
tree | 24a6463184343e6681a00a5177c089c6df5f82b6 /spec | |
parent | 3811eb0ba1e8c0f318060696853b1cab7f99dfa3 (diff) |
Simplify specs by not over-expecting
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/wiki/user_creates_wiki_page_spec.rb | 32 | ||||
-rw-r--r-- | spec/features/projects/wiki/user_updates_wiki_page_spec.rb | 18 |
2 files changed, 22 insertions, 28 deletions
diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index d709fe8046f..7e6eef65873 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -11,17 +11,16 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_link 'Wiki' end - context 'wiki project is in the user namespace' do + context 'in the user namespace' do let(:project) { create(:project, namespace: user.namespace) } context 'when wiki is empty' do - scenario 'user can create a new wiki page from the wiki home page' do - expect(page).to have_content('Home · Edit Page') - + scenario 'directly from the wiki home page' do fill_in :wiki_content, with: 'My awesome wiki!' 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!') end end @@ -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 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' fill_in :new_wiki_path, with: 'foo' click_button 'Create Page' - expect(page).to have_content('Foo · Edit Page') - fill_in :wiki_content, with: 'My awesome wiki!' 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!') 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)) } context 'when wiki is empty' do - scenario 'user can create a new wiki page from the wiki home page' do - expect(page).to have_content('Home · Edit Page') - + scenario 'directly from the wiki home page' do fill_in :wiki_content, with: 'My awesome wiki!' 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!') end end @@ -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 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' fill_in :new_wiki_path, with: 'foo' click_button 'Create Page' - expect(page).to have_content('Foo · Edit Page') - fill_in :wiki_content, with: 'My awesome wiki!' 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!') end end diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index b69d6b46ac8..ef82d2375dd 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -12,34 +12,32 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do click_link 'Wiki' end - context 'wiki project is in the user namespace' do + context 'in the user namespace' do let(:project) { create(:project, namespace: user.namespace) } - scenario 'user can update the wiki home page' do + scenario 'the home page' do click_link 'Edit' - expect(page).to have_content('Home · Edit Page') - fill_in :wiki_content, with: 'My awesome wiki!' 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!') 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)) } - scenario 'user can update the wiki home page' do + scenario 'the home page' do click_link 'Edit' - expect(page).to have_content('Home · Edit Page') - fill_in :wiki_content, with: 'My awesome wiki!' 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!') end end |