Merge branch 'replace_profile_active_tab.feature' into 'master'

Replace the 'profile/active_tab.feature' spinach test with an rspec analog

See merge request !14239
This commit is contained in:
Rémy Coutable 2017-09-13 10:58:07 +00:00
commit 4fb6848fdb
8 changed files with 79 additions and 58 deletions

View file

@ -0,0 +1,5 @@
---
title: Replace the 'profile/active_tab.feature' spinach test with an rspec analog
merge_request: 14239
author: Vitaliy @blackst0ne Klachkov
type: other

View file

@ -1,29 +0,0 @@
@profile
Feature: Profile Active Tab
Background:
Given I sign in as a user
Scenario: On Profile Home
Given I visit profile page
Then the active main tab should be Home
And no other main tabs should be active
Scenario: On Profile Account
Given I visit profile account page
Then the active main tab should be Account
And no other main tabs should be active
Scenario: On Profile SSH Keys
Given I visit profile SSH keys page
Then the active main tab should be SSH Keys
And no other main tabs should be active
Scenario: On Profile Preferences
Given I visit profile preferences page
Then the active main tab should be Preferences
And no other main tabs should be active
Scenario: On Profile Authentication log
Given I visit Authentication log page
Then the active main tab should be Authentication log
And no other main tabs should be active

View file

@ -1,25 +0,0 @@
class Spinach::Features::ProfileActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedActiveTab
step 'the active main tab should be Home' do
ensure_active_main_tab('Profile')
end
step 'the active main tab should be Account' do
ensure_active_main_tab('Account')
end
step 'the active main tab should be SSH Keys' do
ensure_active_main_tab('SSH Keys')
end
step 'the active main tab should be Preferences' do
ensure_active_main_tab('Preferences')
end
step 'the active main tab should be Authentication log' do
ensure_active_main_tab('Authentication log')
end
end

View file

@ -0,0 +1,16 @@
require 'spec_helper'
describe 'User visits the profile account page' do
let(:user) { create(:user) }
before do
sign_in(user)
visit(profile_account_path)
end
it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Account')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end
end

View file

@ -0,0 +1,16 @@
require 'spec_helper'
describe 'User visits the authentication log page' do
let(:user) { create(:user) }
before do
sign_in(user)
visit(audit_log_profile_path)
end
it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Authentication log')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end
end

View file

@ -0,0 +1,16 @@
require 'spec_helper'
describe 'User visits the profile page' do
let(:user) { create(:user) }
before do
sign_in(user)
visit(profile_path)
end
it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Profile')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end
end

View file

@ -1,14 +1,20 @@
require 'spec_helper'
describe 'Profile > Preferences', :js do
describe 'User visits the profile preferences page' do
let(:user) { create(:user) }
before do
sign_in(user)
visit profile_preferences_path
visit(profile_preferences_path)
end
describe 'User changes their syntax highlighting theme' do
it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('Preferences')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end
describe 'User changes their syntax highlighting theme', :js do
it 'creates a flash message' do
choose 'user_color_scheme_id_5'
@ -27,7 +33,7 @@ describe 'Profile > Preferences', :js do
end
end
describe 'User changes their default dashboard' do
describe 'User changes their default dashboard', :js do
it 'creates a flash message' do
select 'Starred Projects', from: 'user_dashboard'
click_button 'Save'

View file

@ -0,0 +1,16 @@
require 'spec_helper'
describe 'User visits the profile SSH keys page' do
let(:user) { create(:user) }
before do
sign_in(user)
visit(profile_keys_path)
end
it 'shows correct menu item' do
expect(find('.sidebar-top-level-items > li.active')).to have_content('SSH Keys')
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
end
end