提交 4fb6848f 编写于 作者: R Rémy Coutable

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
---
title: Replace the 'profile/active_tab.feature' spinach test with an rspec analog
merge_request: 14239
author: Vitaliy @blackst0ne Klachkov
type: other
@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
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
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
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
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
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
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' do
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'
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册