Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
40264b87
Commit
40264b87
authored
Dec 24, 2017
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move invites spinach test to Rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
228f42b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
125 deletions
+97
-125
features/invites.feature
features/invites.feature
+0
-45
features/steps/invites.rb
features/steps/invites.rb
+0
-80
spec/features/invites_spec.rb
spec/features/invites_spec.rb
+97
-0
No files found.
features/invites.feature
deleted
100644 → 0
View file @
228f42b5
Feature
:
Invites
Background
:
Given
"John Doe"
is owner of group
"Owned"
And
"John Doe"
has invited
"user@example.com"
to group
"Owned"
Scenario
:
Viewing invitation when signed out
When
I visit the invitation page
Then
I should be redirected to the sign in page
And
I should see a notice telling me to sign in
Scenario
:
Signing in to view invitation
When
I visit the invitation page
And
I sign in as
"Mary Jane"
Then
I should be redirected to the invitation page
Scenario
:
Viewing invitation when signed in
Given
I sign in as
"Mary Jane"
And
I visit the invitation page
Then
I should see the invitation details
And
I should see an
"Accept invitation"
button
And
I should see a
"Decline"
button
Scenario
:
Viewing invitation as an existing member
Given
I sign in as
"John Doe"
And
I visit the invitation page
Then
I should see a message telling me I'm already a member
Scenario
:
Accepting the invitation
Given
I sign in as
"Mary Jane"
And
I visit the invitation page
And
I click the
"Accept invitation"
button
Then
I should be redirected to the group page
And
I should see a notice telling me I have access
Scenario
:
Declining the application when signed in
Given
I sign in as
"Mary Jane"
And
I visit the invitation page
And
I click the
"Decline"
button
Then
I should be redirected to the dashboard
And
I should see a notice telling me I have declined
Scenario
:
Declining the application when signed out
When
I visit the invitation's decline page
Then
I should be redirected to the sign in page
And
I should see a notice telling me I have declined
features/steps/invites.rb
deleted
100644 → 0
View file @
228f42b5
class
Spinach::Features::Invites
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedUser
include
SharedGroup
step
'"John Doe" has invited "user@example.com" to group "Owned"'
do
user
=
User
.
find_by
(
name:
"John Doe"
)
group
=
Group
.
find_by
(
name:
"Owned"
)
group
.
add_developer
(
"user@example.com"
,
user
)
end
step
'I visit the invitation page'
do
group
=
Group
.
find_by
(
name:
"Owned"
)
invite
=
group
.
group_members
.
invite
.
last
invite
.
generate_invite_token!
@raw_invite_token
=
invite
.
raw_invite_token
visit
invite_path
(
@raw_invite_token
)
end
step
'I should be redirected to the sign in page'
do
expect
(
current_path
).
to
eq
(
new_user_session_path
)
end
step
'I should see a notice telling me to sign in'
do
expect
(
page
).
to
have_content
"To accept this invitation, sign in"
end
step
'I should be redirected to the invitation page'
do
expect
(
current_path
).
to
eq
(
invite_path
(
@raw_invite_token
))
end
step
'I should see the invitation details'
do
expect
(
page
).
to
have_content
(
"You have been invited by John Doe to join group Owned as Developer."
)
end
step
"I should see a message telling me I'm already a member"
do
expect
(
page
).
to
have_content
(
"However, you are already a member of this group."
)
end
step
'I should see an "Accept invitation" button'
do
expect
(
page
).
to
have_link
(
"Accept invitation"
)
end
step
'I should see a "Decline" button'
do
expect
(
page
).
to
have_link
(
"Decline"
)
end
step
'I click the "Accept invitation" button'
do
page
.
click_link
"Accept invitation"
end
step
'I should be redirected to the group page'
do
group
=
Group
.
find_by
(
name:
"Owned"
)
expect
(
current_path
).
to
eq
(
group_path
(
group
))
end
step
'I should see a notice telling me I have access'
do
expect
(
page
).
to
have_content
(
"You have been granted Developer access to group Owned."
)
end
step
'I click the "Decline" button'
do
page
.
click_link
"Decline"
end
step
'I should be redirected to the dashboard'
do
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
end
step
'I should see a notice telling me I have declined'
do
expect
(
page
).
to
have_content
(
"You have declined the invitation to join group Owned."
)
end
step
"I visit the invitation's decline page"
do
group
=
Group
.
find_by
(
name:
"Owned"
)
invite
=
group
.
group_members
.
invite
.
last
invite
.
generate_invite_token!
@raw_invite_token
=
invite
.
raw_invite_token
visit
decline_invite_path
(
@raw_invite_token
)
end
end
spec/features/invites_spec.rb
0 → 100644
View file @
40264b87
require
'spec_helper'
describe
'Invites'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:group
)
{
create
(
:group
,
name:
'Owned'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
group
)
}
let
(
:invite
)
{
group
.
group_members
.
invite
.
last
}
before
do
project
.
add_master
(
owner
)
group
.
add_user
(
owner
,
Gitlab
::
Access
::
OWNER
)
group
.
add_developer
(
'user@example.com'
,
owner
)
invite
.
generate_invite_token!
end
context
'when signed out'
do
before
do
visit
invite_path
(
invite
.
raw_invite_token
)
end
it
'renders sign in page with sign in notice'
do
expect
(
current_path
).
to
eq
(
new_user_session_path
)
expect
(
page
).
to
have_content
(
'To accept this invitation, sign in'
)
end
it
'sign in and redirects to invitation page'
do
fill_in
'user_login'
,
with:
user
.
email
fill_in
'user_password'
,
with:
user
.
password
check
'user_remember_me'
click_button
'Sign in'
expect
(
current_path
).
to
eq
(
invite_path
(
invite
.
raw_invite_token
))
expect
(
page
).
to
have_content
(
'You have been invited by John Doe to join group Owned as Developer.'
)
expect
(
page
).
to
have_link
(
'Accept invitation'
)
expect
(
page
).
to
have_link
(
'Decline'
)
end
end
context
'when signed in as an exists member'
do
before
do
sign_in
(
owner
)
end
it
'shows message user already a member'
do
visit
invite_path
(
invite
.
raw_invite_token
)
expect
(
page
).
to
have_content
(
'However, you are already a member of this group.'
)
end
end
describe
'accepting the invitation'
do
before
do
sign_in
(
user
)
visit
invite_path
(
invite
.
raw_invite_token
)
end
it
'grants access and redirects to group page'
do
page
.
click_link
'Accept invitation'
expect
(
current_path
).
to
eq
(
group_path
(
group
))
expect
(
page
).
to
have_content
(
'You have been granted Developer access to group Owned.'
)
end
end
describe
'declining the application'
do
context
'when signed in'
do
before
do
sign_in
(
user
)
visit
invite_path
(
invite
.
raw_invite_token
)
end
it
'declines application and redirects to dashboard'
do
page
.
click_link
'Decline'
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
page
).
to
have_content
(
'You have declined the invitation to join group Owned.'
)
end
end
context
'when signed out'
do
before
do
visit
decline_invite_path
(
invite
.
raw_invite_token
)
end
it
'declines application and redirects to sign in page'
do
expect
(
current_path
).
to
eq
(
new_user_session_path
)
expect
(
page
).
to
have_content
(
'You have declined the invitation to join group Owned.'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment