Commit ef6e94e3 authored by Ciro Santilli's avatar Ciro Santilli

Replace old spinach step definitions with step.

parent fda61a04
...@@ -3,35 +3,35 @@ class AdminActiveTab < Spinach::FeatureSteps ...@@ -3,35 +3,35 @@ class AdminActiveTab < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedActiveTab include SharedActiveTab
Then 'the active main tab should be Home' do step 'the active main tab should be Home' do
ensure_active_main_tab('Overview') ensure_active_main_tab('Overview')
end end
Then 'the active main tab should be Projects' do step 'the active main tab should be Projects' do
ensure_active_main_tab('Projects') ensure_active_main_tab('Projects')
end end
Then 'the active main tab should be Groups' do step 'the active main tab should be Groups' do
ensure_active_main_tab('Groups') ensure_active_main_tab('Groups')
end end
Then 'the active main tab should be Users' do step 'the active main tab should be Users' do
ensure_active_main_tab('Users') ensure_active_main_tab('Users')
end end
Then 'the active main tab should be Logs' do step 'the active main tab should be Logs' do
ensure_active_main_tab('Logs') ensure_active_main_tab('Logs')
end end
Then 'the active main tab should be Hooks' do step 'the active main tab should be Hooks' do
ensure_active_main_tab('Hooks') ensure_active_main_tab('Hooks')
end end
Then 'the active main tab should be Resque' do step 'the active main tab should be Resque' do
ensure_active_main_tab('Background Jobs') ensure_active_main_tab('Background Jobs')
end end
Then 'the active main tab should be Messages' do step 'the active main tab should be Messages' do
ensure_active_main_tab('Messages') ensure_active_main_tab('Messages')
end end
end end
...@@ -13,7 +13,7 @@ class AdminGroups < Spinach::FeatureSteps ...@@ -13,7 +13,7 @@ class AdminGroups < Spinach::FeatureSteps
click_link "New Group" click_link "New Group"
end end
And 'I have group with projects' do step 'I have group with projects' do
@group = create(:group) @group = create(:group)
@project = create(:project, group: @group) @project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project) @event = create(:closed_issue_event, project: @project)
...@@ -21,18 +21,18 @@ class AdminGroups < Spinach::FeatureSteps ...@@ -21,18 +21,18 @@ class AdminGroups < Spinach::FeatureSteps
@project.team << [current_user, :master] @project.team << [current_user, :master]
end end
And 'submit form with new group info' do step 'submit form with new group info' do
fill_in 'group_name', with: 'gitlab' fill_in 'group_name', with: 'gitlab'
fill_in 'group_description', with: 'Group description' fill_in 'group_description', with: 'Group description'
click_button "Create group" click_button "Create group"
end end
Then 'I should see newly created group' do step 'I should see newly created group' do
page.should have_content "Group: gitlab" page.should have_content "Group: gitlab"
page.should have_content "Group description" page.should have_content "Group description"
end end
Then 'I should be redirected to group page' do step 'I should be redirected to group page' do
current_path.should == admin_group_path(Group.last) current_path.should == admin_group_path(Group.last)
end end
...@@ -45,7 +45,7 @@ class AdminGroups < Spinach::FeatureSteps ...@@ -45,7 +45,7 @@ class AdminGroups < Spinach::FeatureSteps
click_button "Add users into group" click_button "Add users into group"
end end
Then 'I should see "John Doe" in team list in every project as "Reporter"' do step 'I should see "John Doe" in team list in every project as "Reporter"' do
within ".group-users-list" do within ".group-users-list" do
page.should have_content "John Doe" page.should have_content "John Doe"
page.should have_content "Reporter" page.should have_content "Reporter"
......
...@@ -3,7 +3,7 @@ class AdminLogs < Spinach::FeatureSteps ...@@ -3,7 +3,7 @@ class AdminLogs < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedAdmin include SharedAdmin
Then 'I should see tabs with available logs' do step 'I should see tabs with available logs' do
page.should have_content 'production.log' page.should have_content 'production.log'
page.should have_content 'githost.log' page.should have_content 'githost.log'
page.should have_content 'application.log' page.should have_content 'application.log'
......
...@@ -3,17 +3,17 @@ class AdminProjects < Spinach::FeatureSteps ...@@ -3,17 +3,17 @@ class AdminProjects < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedAdmin include SharedAdmin
And 'I should see all projects' do step 'I should see all projects' do
Project.all.each do |p| Project.all.each do |p|
page.should have_content p.name_with_namespace page.should have_content p.name_with_namespace
end end
end end
And 'I click on first project' do step 'I click on first project' do
click_link Project.first.name_with_namespace click_link Project.first.name_with_namespace
end end
Then 'I should see project details' do step 'I should see project details' do
project = Project.first project = Project.first
current_path.should == admin_project_path(project) current_path.should == admin_project_path(project)
page.should have_content(project.name_with_namespace) page.should have_content(project.name_with_namespace)
......
...@@ -3,32 +3,32 @@ class AdminUsers < Spinach::FeatureSteps ...@@ -3,32 +3,32 @@ class AdminUsers < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedAdmin include SharedAdmin
Then 'I should see all users' do step 'I should see all users' do
User.all.each do |user| User.all.each do |user|
page.should have_content user.name page.should have_content user.name
end end
end end
And 'Click edit' do step 'Click edit' do
@user = User.first @user = User.first
find("#edit_user_#{@user.id}").click find("#edit_user_#{@user.id}").click
end end
And 'Input non ascii char in username' do step 'Input non ascii char in username' do
fill_in 'user_username', with: "\u3042\u3044" fill_in 'user_username', with: "\u3042\u3044"
end end
And 'Click save' do step 'Click save' do
click_button("Save") click_button("Save")
end end
Then 'See username error message' do step 'See username error message' do
within "#error_explanation" do within "#error_explanation" do
page.should have_content "Username" page.should have_content "Username"
end end
end end
And 'Not changed form action url' do step 'Not changed form action url' do
page.should have_selector %(form[action="/admin/users/#{@user.username}"]) page.should have_selector %(form[action="/admin/users/#{@user.username}"])
end end
......
...@@ -3,31 +3,31 @@ class Dashboard < Spinach::FeatureSteps ...@@ -3,31 +3,31 @@ class Dashboard < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedProject include SharedProject
Then 'I should see "New Project" link' do step 'I should see "New Project" link' do
page.should have_link "New project" page.should have_link "New project"
end end
Then 'I should see "Shop" project link' do step 'I should see "Shop" project link' do
page.should have_link "Shop" page.should have_link "Shop"
end end
Then 'I should see last push widget' do step 'I should see last push widget' do
page.should have_content "You pushed to fix" page.should have_content "You pushed to fix"
page.should have_link "Create Merge Request" page.should have_link "Create Merge Request"
end end
And 'I click "Create Merge Request" link' do step 'I click "Create Merge Request" link' do
click_link "Create Merge Request" click_link "Create Merge Request"
end end
Then 'I see prefilled new Merge Request page' do step 'I see prefilled new Merge Request page' do
current_path.should == new_project_merge_request_path(@project) current_path.should == new_project_merge_request_path(@project)
find("#merge_request_target_project_id").value.should == @project.id.to_s find("#merge_request_target_project_id").value.should == @project.id.to_s
find("#merge_request_source_branch").value.should == "fix" find("#merge_request_source_branch").value.should == "fix"
find("#merge_request_target_branch").value.should == "master" find("#merge_request_target_branch").value.should == "master"
end end
Given 'user with name "John Doe" joined project "Shop"' do step 'user with name "John Doe" joined project "Shop"' do
user = create(:user, {name: "John Doe"}) user = create(:user, {name: "John Doe"})
project.team << [user, :master] project.team << [user, :master]
Event.create( Event.create(
...@@ -37,11 +37,11 @@ class Dashboard < Spinach::FeatureSteps ...@@ -37,11 +37,11 @@ class Dashboard < Spinach::FeatureSteps
) )
end end
Then 'I should see "John Doe joined project at Shop" event' do step 'I should see "John Doe joined project at Shop" event' do
page.should have_content "John Doe joined project at #{project.name_with_namespace}" page.should have_content "John Doe joined project at #{project.name_with_namespace}"
end end
And 'user with name "John Doe" left project "Shop"' do step 'user with name "John Doe" left project "Shop"' do
user = User.find_by(name: "John Doe") user = User.find_by(name: "John Doe")
Event.create( Event.create(
project: project, project: project,
...@@ -50,11 +50,11 @@ class Dashboard < Spinach::FeatureSteps ...@@ -50,11 +50,11 @@ class Dashboard < Spinach::FeatureSteps
) )
end end
Then 'I should see "John Doe left project at Shop" event' do step 'I should see "John Doe left project at Shop" event' do
page.should have_content "John Doe left project at #{project.name_with_namespace}" page.should have_content "John Doe left project at #{project.name_with_namespace}"
end end
And 'I have group with projects' do step 'I have group with projects' do
@group = create(:group) @group = create(:group)
@project = create(:project, namespace: @group) @project = create(:project, namespace: @group)
@event = create(:closed_issue_event, project: @project) @event = create(:closed_issue_event, project: @project)
...@@ -62,24 +62,24 @@ class Dashboard < Spinach::FeatureSteps ...@@ -62,24 +62,24 @@ class Dashboard < Spinach::FeatureSteps
@project.team << [current_user, :master] @project.team << [current_user, :master]
end end
Then 'I should see projects list' do step 'I should see projects list' do
@user.authorized_projects.all.each do |project| @user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace page.should have_link project.name_with_namespace
end end
end end
Then 'I should see groups list' do step 'I should see groups list' do
Group.all.each do |group| Group.all.each do |group|
page.should have_link group.name page.should have_link group.name
end end
end end
And 'group has a projects that does not belongs to me' do step 'group has a projects that does not belongs to me' do
@forbidden_project1 = create(:project, group: @group) @forbidden_project1 = create(:project, group: @group)
@forbidden_project2 = create(:project, group: @group) @forbidden_project2 = create(:project, group: @group)
end end
Then 'I should see 1 project at group list' do step 'I should see 1 project at group list' do
page.find('span.last_activity/span').should have_content('1') page.find('span.last_activity/span').should have_content('1')
end end
......
...@@ -3,31 +3,31 @@ class EventFilters < Spinach::FeatureSteps ...@@ -3,31 +3,31 @@ class EventFilters < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedProject include SharedProject
Then 'I should see push event' do step 'I should see push event' do
page.should have_selector('span.pushed') page.should have_selector('span.pushed')
end end
Then 'I should not see push event' do step 'I should not see push event' do
page.should_not have_selector('span.pushed') page.should_not have_selector('span.pushed')
end end
Then 'I should see new member event' do step 'I should see new member event' do
page.should have_selector('span.joined') page.should have_selector('span.joined')
end end
And 'I should not see new member event' do step 'I should not see new member event' do
page.should_not have_selector('span.joined') page.should_not have_selector('span.joined')
end end
Then 'I should see merge request event' do step 'I should see merge request event' do
page.should have_selector('span.accepted') page.should have_selector('span.accepted')
end end
And 'I should not see merge request event' do step 'I should not see merge request event' do
page.should_not have_selector('span.accepted') page.should_not have_selector('span.accepted')
end end
And 'this project has push event' do step 'this project has push event' do
data = { data = {
before: "0000000000000000000000000000000000000000", before: "0000000000000000000000000000000000000000",
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
...@@ -51,7 +51,7 @@ class EventFilters < Spinach::FeatureSteps ...@@ -51,7 +51,7 @@ class EventFilters < Spinach::FeatureSteps
) )
end end
And 'this project has new member event' do step 'this project has new member event' do
user = create(:user, {name: "John Doe"}) user = create(:user, {name: "John Doe"})
Event.create( Event.create(
project: @project, project: @project,
...@@ -60,7 +60,7 @@ class EventFilters < Spinach::FeatureSteps ...@@ -60,7 +60,7 @@ class EventFilters < Spinach::FeatureSteps
) )
end end
And 'this project has merge request event' do step 'this project has merge request event' do
merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project
Event.create( Event.create(
project: @project, project: @project,
......
...@@ -3,7 +3,7 @@ class DashboardProjects < Spinach::FeatureSteps ...@@ -3,7 +3,7 @@ class DashboardProjects < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedProject include SharedProject
Then 'I should see projects list' do step 'I should see projects list' do
@user.authorized_projects.all.each do |project| @user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace page.should have_link project.name_with_namespace
end end
......
...@@ -8,15 +8,15 @@ class DashboardWithArchivedProjects < Spinach::FeatureSteps ...@@ -8,15 +8,15 @@ class DashboardWithArchivedProjects < Spinach::FeatureSteps
project.update_attribute(:archived, true) project.update_attribute(:archived, true)
end end
Then 'I should see "Shop" project link' do step 'I should see "Shop" project link' do
page.should have_link "Shop" page.should have_link "Shop"
end end
Then 'I should not see "Forum" project link' do step 'I should not see "Forum" project link' do
page.should_not have_link "Forum" page.should_not have_link "Forum"
end end
Then 'I should see "Forum" project link' do step 'I should see "Forum" project link' do
page.should have_link "Forum" page.should have_link "Forum"
end end
end end
...@@ -5,29 +5,29 @@ class Groups < Spinach::FeatureSteps ...@@ -5,29 +5,29 @@ class Groups < Spinach::FeatureSteps
include SharedUser include SharedUser
include Select2Helper include Select2Helper
Then 'I should see group "Owned" projects list' do step 'I should see group "Owned" projects list' do
Group.find_by(name: "Owned").projects.each do |project| Group.find_by(name: "Owned").projects.each do |project|
page.should have_link project.name page.should have_link project.name
end end
end end
And 'I should see projects activity feed' do step 'I should see projects activity feed' do
page.should have_content 'closed issue' page.should have_content 'closed issue'
end end
Then 'I should see issues from group "Owned" assigned to me' do step 'I should see issues from group "Owned" assigned to me' do
assigned_to_me(:issues).each do |issue| assigned_to_me(:issues).each do |issue|
page.should have_content issue.title page.should have_content issue.title
end end
end end
Then 'I should see merge requests from group "Owned" assigned to me' do step 'I should see merge requests from group "Owned" assigned to me' do
assigned_to_me(:merge_requests).each do |issue| assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80] page.should have_content issue.title[0..80]
end end
end end
And 'I select user "Mary Jane" from list with role "Reporter"' do step 'I select user "Mary Jane" from list with role "Reporter"' do
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane") user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_link 'Add members' click_link 'Add members'
within ".users-group-form" do within ".users-group-form" do
...@@ -37,34 +37,34 @@ class Groups < Spinach::FeatureSteps ...@@ -37,34 +37,34 @@ class Groups < Spinach::FeatureSteps
click_button "Add users into group" click_button "Add users into group"
end end
Then 'I should see user "John Doe" in team list' do step 'I should see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list") projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("John Doe") projects_with_access.should have_content("John Doe")
end end
Then 'I should not see user "John Doe" in team list' do step 'I should not see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list") projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("John Doe") projects_with_access.should_not have_content("John Doe")
end end
Then 'I should see user "Mary Jane" in team list' do step 'I should see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list") projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("Mary Jane") projects_with_access.should have_content("Mary Jane")
end end
Then 'I should not see user "Mary Jane" in team list' do step 'I should not see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list") projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("Mary Jane") projects_with_access.should_not have_content("Mary Jane")
end end
Given 'project from group "Owned" has issues assigned to me' do step 'project from group "Owned" has issues assigned to me' do
create :issue, create :issue,
project: project, project: project,
assignee: current_user, assignee: current_user,
author: current_user author: current_user
end end
Given 'project from group "Owned" has merge requests assigned to me' do step 'project from group "Owned" has merge requests assigned to me' do
create :merge_request, create :merge_request,
source_project: project, source_project: project,
target_project: project, target_project: project,
...@@ -76,28 +76,28 @@ class Groups < Spinach::FeatureSteps ...@@ -76,28 +76,28 @@ class Groups < Spinach::FeatureSteps
click_link "New group" click_link "New group"
end end
And 'submit form with new group "Samurai" info' do step 'submit form with new group "Samurai" info' do
fill_in 'group_name', with: 'Samurai' fill_in 'group_name', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate' fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group" click_button "Create group"
end end
Then 'I should be redirected to group "Samurai" page' do step 'I should be redirected to group "Samurai" page' do
current_path.should == group_path(Group.last) current_path.should == group_path(Group.last)
end end
Then 'I should see newly created group "Samurai"' do step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai" page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate" page.should have_content "Tokugawa Shogunate"
page.should have_content "Currently you are only seeing events from the" page.should have_content "Currently you are only seeing events from the"
end end
And 'I change group "Owned" name to "new-name"' do step 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name' fill_in 'group_name', with: 'new-name'
click_button "Save group" click_button "Save group"
end end
Then 'I should see new group "Owned" name' do step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do within ".navbar-gitlab" do
page.should have_content "group: new-name" page.should have_content "group: new-name"
end end
......
...@@ -3,23 +3,23 @@ class ProfileActiveTab < Spinach::FeatureSteps ...@@ -3,23 +3,23 @@ class ProfileActiveTab < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedActiveTab include SharedActiveTab
Then 'the active main tab should be Home' do step 'the active main tab should be Home' do
ensure_active_main_tab('Profile') ensure_active_main_tab('Profile')
end end
Then 'the active main tab should be Account' do step 'the active main tab should be Account' do
ensure_active_main_tab('Account') ensure_active_main_tab('Account')
end end
Then 'the active main tab should be SSH Keys' do step 'the active main tab should be SSH Keys' do
ensure_active_main_tab('SSH Keys') ensure_active_main_tab('SSH Keys')
end end
Then 'the active main tab should be Design' do step 'the active main tab should be Design' do
ensure_active_main_tab('Design') ensure_active_main_tab('Design')
end end
Then 'the active main tab should be History' do step 'the active main tab should be History' do
ensure_active_main_tab('History') ensure_active_main_tab('History')
end end
end end
class ProfileEmails < Spinach::FeatureSteps class ProfileEmails < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
Then 'I visit profile emails page' do step 'I visit profile emails page' do
visit profile_emails_path visit profile_emails_path
end end
Then 'I should see my emails' do step 'I should see my emails' do
page.should have_content(@user.email) page.should have_content(@user.email)
@user.emails.each do |email| @user.emails.each do |email|
page.should have_content(email.email) page.should have_content(email.email)
end end
end end
And 'I submit new email "my@email.com"' do step 'I submit new email "my@email.com"' do
fill_in "email_email", with: "my@email.com" fill_in "email_email", with: "my@email.com"
click_button "Add" click_button "Add"
end end
Then 'I should see new email "my@email.com"' do step 'I should see new email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com") email = @user.emails.find_by(email: "my@email.com")
email.should_not be_nil email.should_not be_nil
page.should have_content("my@email.com") page.should have_content("my@email.com")
end end
Then 'I should not see email "my@email.com"' do step 'I should not see email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com") email = @user.emails.find_by(email: "my@email.com")
email.should be_nil email.should be_nil
page.should_not have_content("my@email.com") page.should_not have_content("my@email.com")
end end
Then 'I click link "Remove" for "my@email.com"' do step 'I click link "Remove" for "my@email.com"' do
# there should only be one remove button at this time # there should only be one remove button at this time
click_link "Remove" click_link "Remove"
# force these to reload as they have been cached # force these to reload as they have been cached
@user.emails.reload @user.emails.reload
end end
And 'I submit duplicate email @user.email' do step 'I submit duplicate email @user.email' do
fill_in "email_email", with: @user.email fill_in "email_email", with: @user.email
click_button "Add" click_button "Add"
end end
Then 'I should not have @user.email added' do step 'I should not have @user.email added' do
email = @user.emails.find_by(email: @user.email) email = @user.emails.find_by(email: @user.email)
email.should be_nil email.should be_nil
end end
......
class ProfileSshKeys < Spinach::FeatureSteps class ProfileSshKeys < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
Then 'I should see my ssh keys' do step 'I should see my ssh keys' do
@user.keys.each do |key| @user.keys.each do |key|
page.should have_content(key.title) page.should have_content(key.title)
end end
end end
Given 'I click link "Add new"' do step 'I click link "Add new"' do
click_link "Add SSH Key" click_link "Add SSH Key"
end end
And 'I submit new ssh key "Laptop"' do step 'I submit new ssh key "Laptop"' do
fill_in "key_title", with: "Laptop" fill_in "key_title", with: "Laptop"
fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
click_button "Add key" click_button "Add key"
end end
Then 'I should see new ssh key "Laptop"' do step 'I should see new ssh key "Laptop"' do
key = Key.find_by(title: "Laptop") key = Key.find_by(title: "Laptop")
page.should have_content(key.title) page.should have_content(key.title)
page.should have_content(key.key) page.should have_content(key.key)
current_path.should == profile_key_path(key) current_path.should == profile_key_path(key)
end end
Given 'I click link "Work"' do step 'I click link "Work"' do
click_link "Work" click_link "Work"
end end
And 'I click link "Remove"' do step 'I click link "Remove"' do
click_link "Remove" click_link "Remove"
end end
Then 'I visit profile keys page' do step 'I visit profile keys page' do
visit profile_keys_path visit profile_keys_path
end end
And 'I should not see "Work" ssh key' do step 'I should not see "Work" ssh key' do
within "#keys-table" do within "#keys-table" do
page.should_not have_content "Work" page.should_not have_content "Work"
end end
end end
And 'I have ssh key "ssh-rsa Work"' do step 'I have ssh key "ssh-rsa Work"' do
create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work")
end end
end end
...@@ -7,97 +7,97 @@ class ProjectActiveTab < Spinach::FeatureSteps ...@@ -7,97 +7,97 @@ class ProjectActiveTab < Spinach::FeatureSteps
# Sub Tabs: Home # Sub Tabs: Home
Given 'I click the "Team" tab' do step 'I click the "Team" tab' do
click_link('Members') click_link('Members')
end end
Given 'I click the "Attachments" tab' do step 'I click the "Attachments" tab' do
click_link('Attachments') click_link('Attachments')
end end
Given 'I click the "Snippets" tab' do step 'I click the "Snippets" tab' do
click_link('Snippets') click_link('Snippets')
end end
Given 'I click the "Edit" tab' do step 'I click the "Edit" tab' do
within '.project-settings-nav' do within '.project-settings-nav' do
click_link('Project') click_link('Project')
end end
end end
Given 'I click the "Hooks" tab' do step 'I click the "Hooks" tab' do
click_link('Web Hooks') click_link('Web Hooks')
end end
Given 'I click the "Deploy Keys" tab' do step 'I click the "Deploy Keys" tab' do
click_link('Deploy Keys') click_link('Deploy Keys')
end end
Then 'the active sub nav should be Team' do step 'the active sub nav should be Team' do
ensure_active_sub_nav('Members') ensure_active_sub_nav('Members')
end end
Then 'the active sub nav should be Edit' do step 'the active sub nav should be Edit' do
ensure_active_sub_nav('Project') ensure_active_sub_nav('Project')
end end
Then 'the active sub nav should be Hooks' do step 'the active sub nav should be Hooks' do
ensure_active_sub_nav('Web Hooks') ensure_active_sub_nav('Web Hooks')
end end
Then 'the active sub nav should be Deploy Keys' do step 'the active sub nav should be Deploy Keys' do
ensure_active_sub_nav('Deploy Keys') ensure_active_sub_nav('Deploy Keys')
end end
# Sub Tabs: Commits # Sub Tabs: Commits
Given 'I click the "Compare" tab' do step 'I click the "Compare" tab' do
click_link('Compare') click_link('Compare')
end end
Given 'I click the "Branches" tab' do step 'I click the "Branches" tab' do
click_link('Branches') click_link('Branches')
end end
Given 'I click the "Tags" tab' do step 'I click the "Tags" tab' do
click_link('Tags') click_link('Tags')
end end
Then 'the active sub tab should be Commits' do step 'the active sub tab should be Commits' do
ensure_active_sub_tab('Commits') ensure_active_sub_tab('Commits')
end end
Then 'the active sub tab should be Compare' do step 'the active sub tab should be Compare' do
ensure_active_sub_tab('Compare') ensure_active_sub_tab('Compare')
end end
Then 'the active sub tab should be Branches' do step 'the active sub tab should be Branches' do
ensure_active_sub_tab('Branches') ensure_active_sub_tab('Branches')
end end
Then 'the active sub tab should be Tags' do step 'the active sub tab should be Tags' do
ensure_active_sub_tab('Tags') ensure_active_sub_tab('Tags')
end end
# Sub Tabs: Issues # Sub Tabs: Issues
Given 'I click the "Milestones" tab' do step 'I click the "Milestones" tab' do
click_link('Milestones') click_link('Milestones')
end end
Given 'I click the "Labels" tab' do step 'I click the "Labels" tab' do
click_link('Labels') click_link('Labels')
end end
Then 'the active sub tab should be Browse Issues' do step 'the active sub tab should be Browse Issues' do
ensure_active_sub_tab('Browse Issues') ensure_active_sub_tab('Browse Issues')
end end
Then 'the active sub tab should be Milestones' do step 'the active sub tab should be Milestones' do
ensure_active_sub_tab('Milestones') ensure_active_sub_tab('Milestones')
end end
Then 'the active sub tab should be Labels' do step 'the active sub tab should be Labels' do
ensure_active_sub_tab('Labels') ensure_active_sub_tab('Labels')
end end
end end
...@@ -18,11 +18,11 @@ class ProjectArchived < Spinach::FeatureSteps ...@@ -18,11 +18,11 @@ class ProjectArchived < Spinach::FeatureSteps
visit project_path(project) visit project_path(project)
end end
Then 'I should not see "Archived"' do step 'I should not see "Archived"' do
page.should_not have_content "Archived" page.should_not have_content "Archived"
end end
Then 'I should see "Archived"' do step 'I should see "Archived"' do
page.should have_content "Archived" page.should have_content "Archived"
end end
......
...@@ -4,18 +4,18 @@ class ProjectBrowseCommits < Spinach::FeatureSteps ...@@ -4,18 +4,18 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include RepoHelpers include RepoHelpers
Then 'I see project commits' do step 'I see project commits' do
commit = @project.repository.commit commit = @project.repository.commit
page.should have_content(@project.name) page.should have_content(@project.name)
page.should have_content(commit.message[0..20]) page.should have_content(commit.message[0..20])
page.should have_content(commit.id.to_s[0..5]) page.should have_content(commit.id.to_s[0..5])
end end
Given 'I click atom feed link' do step 'I click atom feed link' do
click_link "Feed" click_link "Feed"
end end
Then 'I see commits atom feed' do step 'I see commits atom feed' do
commit = @project.repository.commit commit = @project.repository.commit
page.response_headers['Content-Type'].should have_content("application/atom+xml") page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", text: "Recent commits to #{@project.name}") page.body.should have_selector("title", text: "Recent commits to #{@project.name}")
...@@ -23,69 +23,69 @@ class ProjectBrowseCommits < Spinach::FeatureSteps ...@@ -23,69 +23,69 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.body.should have_selector("entry summary", text: commit.description[0..10]) page.body.should have_selector("entry summary", text: commit.description[0..10])
end end
Given 'I click on commit link' do step 'I click on commit link' do
visit project_commit_path(@project, sample_commit.id) visit project_commit_path(@project, sample_commit.id)
end end
Then 'I see commit info' do step 'I see commit info' do
page.should have_content sample_commit.message page.should have_content sample_commit.message
page.should have_content "Showing #{sample_commit.files_changed_count} changed files" page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
end end
And 'I fill compare fields with refs' do step 'I fill compare fields with refs' do
fill_in "from", with: sample_commit.parent_id fill_in "from", with: sample_commit.parent_id
fill_in "to", with: sample_commit.id fill_in "to", with: sample_commit.id
click_button "Compare" click_button "Compare"
end end
Then 'I see compared refs' do step 'I see compared refs' do
page.should have_content "Compare View" page.should have_content "Compare View"
page.should have_content "Commits (1)" page.should have_content "Commits (1)"
page.should have_content "Showing 2 changed files" page.should have_content "Showing 2 changed files"
end end
Then 'I see breadcrumb links' do step 'I see breadcrumb links' do
page.should have_selector('ul.breadcrumb') page.should have_selector('ul.breadcrumb')
page.should have_selector('ul.breadcrumb a', count: 4) page.should have_selector('ul.breadcrumb a', count: 4)
end end
Then 'I see commits stats' do step 'I see commits stats' do
page.should have_content 'Top 50 Committers' page.should have_content 'Top 50 Committers'
page.should have_content 'Committers' page.should have_content 'Committers'
page.should have_content 'Total commits' page.should have_content 'Total commits'
page.should have_content 'Authors' page.should have_content 'Authors'
end end
Given 'I visit big commit page' do step 'I visit big commit page' do
Commit::DIFF_SAFE_FILES = 20 Commit::DIFF_SAFE_FILES = 20
visit project_commit_path(@project, sample_big_commit.id) visit project_commit_path(@project, sample_big_commit.id)
end end
Then 'I see big commit warning' do step 'I see big commit warning' do
page.should have_content sample_big_commit.message page.should have_content sample_big_commit.message
page.should have_content "Too many changes" page.should have_content "Too many changes"
Commit::DIFF_SAFE_FILES = 100 Commit::DIFF_SAFE_FILES = 100
end end
Given 'I visit a commit with an image that changed' do step 'I visit a commit with an image that changed' do
visit project_commit_path(@project, sample_image_commit.id) visit project_commit_path(@project, sample_image_commit.id)
end end
Then 'The diff links to both the previous and current image' do step 'The diff links to both the previous and current image' do
links = page.all('.two-up span div a') links = page.all('.two-up span div a')
links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}} links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}}
links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}} links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}}
end end
Given 'I click side-by-side diff button' do step 'I click side-by-side diff button' do
click_link "Side-by-side Diff" click_link "Side-by-side Diff"
end end
Then 'I see side-by-side diff button' do step 'I see side-by-side diff button' do
page.should have_content "Side-by-side Diff" page.should have_content "Side-by-side Diff"
end end
Then 'I see inline diff button' do step 'I see inline diff button' do
page.should have_content "Inline Diff" page.should have_content "Inline Diff"
end end
end end
...@@ -3,11 +3,11 @@ class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps ...@@ -3,11 +3,11 @@ class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
Given 'I click on commit link' do step 'I click on commit link' do
visit project_commit_path(@project, sample_commit.id) visit project_commit_path(@project, sample_commit.id)
end end
Given 'I click on another commit link' do step 'I click on another commit link' do
visit project_commit_path(@project, sample_commit.parent_id) visit project_commit_path(@project, sample_commit.parent_id)
end end
......
...@@ -3,15 +3,15 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps ...@@ -3,15 +3,15 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
Given 'I click on ".gitignore" file in repo' do step 'I click on ".gitignore" file in repo' do
click_link ".gitignore" click_link ".gitignore"
end end
And 'I click blame button' do step 'I click blame button' do
click_link "blame" click_link "blame"
end end
Then 'I should see git file blame' do step 'I should see git file blame' do
page.should have_content "*.rb" page.should have_content "*.rb"
page.should have_content "Dmitriy Zaporozhets" page.should have_content "Dmitriy Zaporozhets"
page.should have_content "Initial commit" page.should have_content "Initial commit"
......
...@@ -2,41 +2,41 @@ class CreateProject < Spinach::FeatureSteps ...@@ -2,41 +2,41 @@ class CreateProject < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
And 'fill project form with valid data' do step 'fill project form with valid data' do
fill_in 'project_name', with: 'Empty' fill_in 'project_name', with: 'Empty'
click_button "Create project" click_button "Create project"
end end
Then 'I should see project page' do step 'I should see project page' do
page.should have_content "Empty" page.should have_content "Empty"
current_path.should == project_path(Project.last) current_path.should == project_path(Project.last)
end end
And 'I should see empty project instuctions' do step 'I should see empty project instuctions' do
page.should have_content "git init" page.should have_content "git init"
page.should have_content "git remote" page.should have_content "git remote"
page.should have_content Project.last.url_to_repo page.should have_content Project.last.url_to_repo
end end
Then 'I see empty project instuctions' do step 'I see empty project instuctions' do
page.should have_content "git init" page.should have_content "git init"
page.should have_content "git remote" page.should have_content "git remote"
page.should have_content Project.last.url_to_repo page.should have_content Project.last.url_to_repo
end end
And 'I click on HTTP' do step 'I click on HTTP' do
click_button 'HTTP' click_button 'HTTP'
end end
Then 'Remote url should update to http link' do step 'Remote url should update to http link' do
page.should have_content "git remote add origin #{Project.last.http_url_to_repo}" page.should have_content "git remote add origin #{Project.last.http_url_to_repo}"
end end
And 'If I click on SSH' do step 'If I click on SSH' do
click_button 'SSH' click_button 'SSH'
end end
Then 'Remote url should update to ssh link' do step 'Remote url should update to ssh link' do
page.should have_content "git remote add origin #{Project.last.url_to_repo}" page.should have_content "git remote add origin #{Project.last.url_to_repo}"
end end
end end
...@@ -2,7 +2,7 @@ class ProjectGraph < Spinach::FeatureSteps ...@@ -2,7 +2,7 @@ class ProjectGraph < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedProject include SharedProject
Then 'page should have graphs' do step 'page should have graphs' do
page.should have_selector ".stat-graph" page.should have_selector ".stat-graph"
end end
......
...@@ -25,7 +25,7 @@ class ProjectIssueTracker < Spinach::FeatureSteps ...@@ -25,7 +25,7 @@ class ProjectIssueTracker < Spinach::FeatureSteps
find_field('project_issues_tracker').value.should == 'redmine' find_field('project_issues_tracker').value.should == 'redmine'
end end
And 'I save project' do step 'I save project' do
click_button 'Save changes' click_button 'Save changes'
end end
end end
...@@ -5,47 +5,47 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -5,47 +5,47 @@ class ProjectIssues < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedMarkdown include SharedMarkdown
Given 'I should see "Release 0.4" in issues' do step 'I should see "Release 0.4" in issues' do
page.should have_content "Release 0.4" page.should have_content "Release 0.4"
end end
And 'I should not see "Release 0.3" in issues' do step 'I should not see "Release 0.3" in issues' do
page.should_not have_content "Release 0.3" page.should_not have_content "Release 0.3"
end end
And 'I should not see "Tweet control" in issues' do step 'I should not see "Tweet control" in issues' do
page.should_not have_content "Tweet control" page.should_not have_content "Tweet control"
end end
Given 'I click link "Closed"' do step 'I click link "Closed"' do
click_link "Closed" click_link "Closed"
end end
Then 'I should see "Release 0.3" in issues' do step 'I should see "Release 0.3" in issues' do
page.should have_content "Release 0.3" page.should have_content "Release 0.3"
end end
And 'I should not see "Release 0.4" in issues' do step 'I should not see "Release 0.4" in issues' do
page.should_not have_content "Release 0.4" page.should_not have_content "Release 0.4"
end end
Given 'I click link "All"' do step 'I click link "All"' do
click_link "All" click_link "All"
end end
Given 'I click link "Release 0.4"' do step 'I click link "Release 0.4"' do
click_link "Release 0.4" click_link "Release 0.4"
end end
Then 'I should see issue "Release 0.4"' do step 'I should see issue "Release 0.4"' do
page.should have_content "Release 0.4" page.should have_content "Release 0.4"
end end
Given 'I click link "New Issue"' do step 'I click link "New Issue"' do
click_link "New Issue" click_link "New Issue"
end end
And 'I submit new issue "500 error on profile"' do step 'I submit new issue "500 error on profile"' do
fill_in "issue_title", with: "500 error on profile" fill_in "issue_title", with: "500 error on profile"
click_button "Submit new issue" click_button "Submit new issue"
end end
...@@ -56,7 +56,7 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -56,7 +56,7 @@ class ProjectIssues < Spinach::FeatureSteps
click_button "Submit new issue" click_button "Submit new issue"
end end
Given 'I click link "500 error on profile"' do step 'I click link "500 error on profile"' do
click_link "500 error on profile" click_link "500 error on profile"
end end
...@@ -66,41 +66,41 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -66,41 +66,41 @@ class ProjectIssues < Spinach::FeatureSteps
end end
end end
Then 'I should see issue "500 error on profile"' do step 'I should see issue "500 error on profile"' do
issue = Issue.find_by(title: "500 error on profile") issue = Issue.find_by(title: "500 error on profile")
page.should have_content issue.title page.should have_content issue.title
page.should have_content issue.author_name page.should have_content issue.author_name
page.should have_content issue.project.name page.should have_content issue.project.name
end end
Given 'I fill in issue search with "Re"' do step 'I fill in issue search with "Re"' do
filter_issue "Re" filter_issue "Re"
end end
Given 'I fill in issue search with "Bu"' do step 'I fill in issue search with "Bu"' do
filter_issue "Bu" filter_issue "Bu"
end end
And 'I fill in issue search with ".3"' do step 'I fill in issue search with ".3"' do
filter_issue ".3" filter_issue ".3"
end end
And 'I fill in issue search with "Something"' do step 'I fill in issue search with "Something"' do
filter_issue "Something" filter_issue "Something"
end end
And 'I fill in issue search with ""' do step 'I fill in issue search with ""' do
filter_issue "" filter_issue ""
end end
Given 'project "Shop" has milestone "v2.2"' do step 'project "Shop" has milestone "v2.2"' do
milestone = create(:milestone, title: "v2.2", project: project) milestone = create(:milestone, title: "v2.2", project: project)
3.times { create(:issue, project: project, milestone: milestone) } 3.times { create(:issue, project: project, milestone: milestone) }
end end
And 'project "Shop" has milestone "v3.0"' do step 'project "Shop" has milestone "v3.0"' do
milestone = create(:milestone, title: "v3.0", project: project) milestone = create(:milestone, title: "v3.0", project: project)
...@@ -111,7 +111,7 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -111,7 +111,7 @@ class ProjectIssues < Spinach::FeatureSteps
select "v3.0", from: "milestone_id" select "v3.0", from: "milestone_id"
end end
Then 'I should see selected milestone with title "v3.0"' do step 'I should see selected milestone with title "v3.0"' do
issues_milestone_selector = "#issue_milestone_id_chzn > a" issues_milestone_selector = "#issue_milestone_id_chzn > a"
page.find(issues_milestone_selector).should have_content("v3.0") page.find(issues_milestone_selector).should have_content("v3.0")
end end
...@@ -122,14 +122,14 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -122,14 +122,14 @@ class ProjectIssues < Spinach::FeatureSteps
select first_assignee.name, from: "assignee_id" select first_assignee.name, from: "assignee_id"
end end
Then 'I should see first assignee from "Shop" as selected assignee' do step 'I should see first assignee from "Shop" as selected assignee' do
issues_assignee_selector = "#issue_assignee_id_chzn > a" issues_assignee_selector = "#issue_assignee_id_chzn > a"
assignee_name = project.users.first.name assignee_name = project.users.first.name
page.find(issues_assignee_selector).should have_content(assignee_name) page.find(issues_assignee_selector).should have_content(assignee_name)
end end
And 'project "Shop" have "Release 0.4" open issue' do step 'project "Shop" have "Release 0.4" open issue' do
create(:issue, create(:issue,
title: "Release 0.4", title: "Release 0.4",
...@@ -139,21 +139,21 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -139,21 +139,21 @@ class ProjectIssues < Spinach::FeatureSteps
) )
end end
And 'project "Shop" have "Tweet control" open issue' do step 'project "Shop" have "Tweet control" open issue' do
create(:issue, create(:issue,
title: "Tweet control", title: "Tweet control",
project: project, project: project,
author: project.users.first) author: project.users.first)
end end
And 'project "Shop" have "Release 0.3" closed issue' do step 'project "Shop" have "Release 0.3" closed issue' do
create(:closed_issue, create(:closed_issue,
title: "Release 0.3", title: "Release 0.3",
project: project, project: project,
author: project.users.first) author: project.users.first)
end end
Given 'empty project "Empty Project"' do step 'empty project "Empty Project"' do
create :empty_project, name: 'Empty Project', namespace: @user.namespace create :empty_project, name: 'Empty Project', namespace: @user.namespace
end end
...@@ -162,7 +162,7 @@ class ProjectIssues < Spinach::FeatureSteps ...@@ -162,7 +162,7 @@ class ProjectIssues < Spinach::FeatureSteps
visit project_path(project) visit project_path(project)
end end
And 'I see empty project details with ssh clone info' do step 'I see empty project details with ssh clone info' do
project = Project.find_by(name: 'Empty Project') project = Project.find_by(name: 'Empty Project')
page.all(:css, '.git-empty .clone').each do |element| page.all(:css, '.git-empty .clone').each do |element|
element.text.should include(project.url_to_repo) element.text.should include(project.url_to_repo)
......
...@@ -6,19 +6,19 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps ...@@ -6,19 +6,19 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedMarkdown include SharedMarkdown
And 'I own project "Delta"' do step 'I own project "Delta"' do
@project = Project.find_by(name: "Delta") @project = Project.find_by(name: "Delta")
@project ||= create(:project, name: "Delta", namespace: @user.namespace) @project ||= create(:project, name: "Delta", namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
Then 'I should see files from repository in markdown' do step 'I should see files from repository in markdown' do
current_path.should == project_tree_path(@project, "markdown") current_path.should == project_tree_path(@project, "markdown")
page.should have_content "README.md" page.should have_content "README.md"
page.should have_content "CHANGELOG" page.should have_content "CHANGELOG"
end end
And 'I should see rendered README which contains correct links' do step 'I should see rendered README which contains correct links' do
page.should have_content "Welcome to GitLab GitLab is a free project and repository management application" page.should have_content "Welcome to GitLab GitLab is a free project and repository management application"
page.should have_link "GitLab API doc" page.should have_link "GitLab API doc"
page.should have_link "GitLab API website" page.should have_link "GitLab API website"
...@@ -28,79 +28,79 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps ...@@ -28,79 +28,79 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
page.should have_link "Maintenance" page.should have_link "Maintenance"
end end
And 'I click on Gitlab API in README' do step 'I click on Gitlab API in README' do
click_link "GitLab API doc" click_link "GitLab API doc"
end end
Then 'I should see correct document rendered' do step 'I should see correct document rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "All API requests require authentication" page.should have_content "All API requests require authentication"
end end
And 'I click on Rake tasks in README' do step 'I click on Rake tasks in README' do
click_link "Rake tasks" click_link "Rake tasks"
end end
Then 'I should see correct directory rendered' do step 'I should see correct directory rendered' do
current_path.should == project_tree_path(@project, "markdown/doc/raketasks") current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
page.should have_content "backup_restore.md" page.should have_content "backup_restore.md"
page.should have_content "maintenance.md" page.should have_content "maintenance.md"
end end
And 'I click on GitLab API doc directory in README' do step 'I click on GitLab API doc directory in README' do
click_link "GitLab API doc directory" click_link "GitLab API doc directory"
end end
Then 'I should see correct doc/api directory rendered' do step 'I should see correct doc/api directory rendered' do
current_path.should == project_tree_path(@project, "markdown/doc/api") current_path.should == project_tree_path(@project, "markdown/doc/api")
page.should have_content "README.md" page.should have_content "README.md"
page.should have_content "users.md" page.should have_content "users.md"
end end
And 'I click on Maintenance in README' do step 'I click on Maintenance in README' do
click_link "Maintenance" click_link "Maintenance"
end end
Then 'I should see correct maintenance file rendered' do step 'I should see correct maintenance file rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md") current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md")
page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production"
end end
And 'I click on link "empty" in the README' do step 'I click on link "empty" in the README' do
within('.readme-holder') do within('.readme-holder') do
click_link "empty" click_link "empty"
end end
end end
And 'I click on link "id" in the README' do step 'I click on link "id" in the README' do
within('.readme-holder') do within('.readme-holder') do
click_link "#id" click_link "#id"
end end
end end
And 'I navigate to the doc/api/README' do step 'I navigate to the doc/api/README' do
click_link "doc" click_link "doc"
click_link "api" click_link "api"
click_link "README.md" click_link "README.md"
end end
And 'I see correct file rendered' do step 'I see correct file rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "Contents" page.should have_content "Contents"
page.should have_link "Users" page.should have_link "Users"
page.should have_link "Rake tasks" page.should have_link "Rake tasks"
end end
And 'I click on users in doc/api/README' do step 'I click on users in doc/api/README' do
click_link "Users" click_link "Users"
end end
Then 'I should see the correct document file' do step 'I should see the correct document file' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "Get a list of users." page.should have_content "Get a list of users."
end end
And 'I click on raketasks in doc/api/README' do step 'I click on raketasks in doc/api/README' do
click_link "Rake tasks" click_link "Rake tasks"
end end
...@@ -122,91 +122,94 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps ...@@ -122,91 +122,94 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
visit project_blob_path(@project, "markdown/d/README.md") visit project_blob_path(@project, "markdown/d/README.md")
end end
Then 'I should see files from repository in markdown branch' do step 'I should see files from repository in markdown branch' do
current_path.should == project_tree_path(@project, "markdown") current_path.should == project_tree_path(@project, "markdown")
page.should have_content "README.md" page.should have_content "README.md"
page.should have_content "CHANGELOG" page.should have_content "CHANGELOG"
end end
And 'I see correct file rendered in markdown branch' do step 'I see correct file rendered in markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "Contents" page.should have_content "Contents"
page.should have_link "Users" page.should have_link "Users"
page.should have_link "Rake tasks" page.should have_link "Rake tasks"
end end
Then 'I should see correct document rendered for markdown branch' do step 'I should see correct document rendered for markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md") current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "All API requests require authentication" page.should have_content "All API requests require authentication"
end end
Then 'I should see correct directory rendered for markdown branch' do step 'I should see correct directory rendered for markdown branch' do
current_path.should == project_tree_path(@project, "markdown/doc/raketasks") current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
page.should have_content "backup_restore.md" page.should have_content "backup_restore.md"
page.should have_content "maintenance.md" page.should have_content "maintenance.md"
end end
Then 'I should see the users document file in markdown branch' do step 'I should see the users document file in markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "Get a list of users." page.should have_content "Get a list of users."
end end
# Expected link contents # Expected link contents
Then 'The link with text "empty" should have url "tree/markdown"' do step 'The link with text "empty" should have url "tree/markdown"' do
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown") find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown")
end end
Then 'The link with text "empty" should have url "blob/markdown/README.md"' do step 'The link with text "empty" should have url "blob/markdown/README.md"' do
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md")
end end
Then 'The link with text "empty" should have url "tree/markdown/d"' do step 'The link with text "empty" should have url "tree/markdown/d"' do
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d") find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d")
end end
Then 'The link with text "empty" should have url "blob/markdown/d/README.md"' do step 'The link with text "empty" should have '\
'url "blob/markdown/d/README.md"' do
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md") find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md")
end end
Then 'The link with text "ID" should have url "tree/markdownID"' do step 'The link with text "ID" should have url "tree/markdownID"' do
find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
end end
Then 'The link with text "/ID" should have url "tree/markdownID"' do step 'The link with text "/ID" should have url "tree/markdownID"' do
find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
end end
Then 'The link with text "README.mdID" should have url "blob/markdown/README.mdID"' do step 'The link with text "README.mdID" '\
'should have url "blob/markdown/README.mdID"' do
find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end end
Then 'The link with text "d/README.mdID" should have url "blob/markdown/d/README.mdID"' do step 'The link with text "d/README.mdID" should have '\
'url "blob/markdown/d/README.mdID"' do
find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id' find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id'
end end
Then 'The link with text "ID" should have url "blob/markdown/README.mdID"' do step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do
find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end end
Then 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do
find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end end
# Wiki # Wiki
Given 'I go to wiki page' do step 'I go to wiki page' do
click_link "Wiki" click_link "Wiki"
current_path.should == project_wiki_path(@project, "home") current_path.should == project_wiki_path(@project, "home")
end end
And 'I add various links to the wiki page' do step 'I add various links to the wiki page' do
fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n" fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n"
fill_in "wiki[message]", with: "Adding links to wiki" fill_in "wiki[message]", with: "Adding links to wiki"
click_button "Create page" click_button "Create page"
end end
Then 'Wiki page should have added links' do step 'Wiki page should have added links' do
current_path.should == project_wiki_path(@project, "home") current_path.should == project_wiki_path(@project, "home")
page.should have_content "test GitLab API doc Rake tasks" page.should have_content "test GitLab API doc Rake tasks"
end end
...@@ -221,11 +224,11 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps ...@@ -221,11 +224,11 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header') header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header')
end end
And 'I click on test link' do step 'I click on test link' do
click_link "test" click_link "test"
end end
Then 'I see new wiki page named test' do step 'I see new wiki page named test' do
current_path.should == project_wiki_path(@project, "test") current_path.should == project_wiki_path(@project, "test")
page.should have_content "Editing" page.should have_content "Editing"
end end
...@@ -235,34 +238,34 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps ...@@ -235,34 +238,34 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
current_path.should == project_wiki_path(@project, "home") current_path.should == project_wiki_path(@project, "home")
end end
And 'I click on GitLab API doc link' do step 'I click on GitLab API doc link' do
click_link "GitLab API" click_link "GitLab API"
end end
Then 'I see Gitlab API document' do step 'I see Gitlab API document' do
current_path.should == project_wiki_path(@project, "api") current_path.should == project_wiki_path(@project, "api")
page.should have_content "Editing" page.should have_content "Editing"
end end
And 'I click on Rake tasks link' do step 'I click on Rake tasks link' do
click_link "Rake tasks" click_link "Rake tasks"
end end
Then 'I see Rake tasks directory' do step 'I see Rake tasks directory' do
current_path.should == project_wiki_path(@project, "raketasks") current_path.should == project_wiki_path(@project, "raketasks")
page.should have_content "Editing" page.should have_content "Editing"
end end
Given 'I go directory which contains README file' do step 'I go directory which contains README file' do
visit project_tree_path(@project, "markdown/doc/api") visit project_tree_path(@project, "markdown/doc/api")
current_path.should == project_tree_path(@project, "markdown/doc/api") current_path.should == project_tree_path(@project, "markdown/doc/api")
end end
And 'I click on a relative link in README' do step 'I click on a relative link in README' do
click_link "Users" click_link "Users"
end end
Then 'I should see the correct markdown' do step 'I should see the correct markdown' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md") current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "List users" page.should have_content "List users"
end end
......
...@@ -4,34 +4,34 @@ class ProjectMilestones < Spinach::FeatureSteps ...@@ -4,34 +4,34 @@ class ProjectMilestones < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedMarkdown include SharedMarkdown
Then 'I should see milestone "v2.2"' do step 'I should see milestone "v2.2"' do
milestone = @project.milestones.find_by(title: "v2.2") milestone = @project.milestones.find_by(title: "v2.2")
page.should have_content(milestone.title[0..10]) page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at) page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues") page.should have_content("Browse Issues")
end end
Given 'I click link "v2.2"' do step 'I click link "v2.2"' do
click_link "v2.2" click_link "v2.2"
end end
Given 'I click link "New Milestone"' do step 'I click link "New Milestone"' do
click_link "New Milestone" click_link "New Milestone"
end end
And 'I submit new milestone "v2.3"' do step 'I submit new milestone "v2.3"' do
fill_in "milestone_title", with: "v2.3" fill_in "milestone_title", with: "v2.3"
click_button "Create milestone" click_button "Create milestone"
end end
Then 'I should see milestone "v2.3"' do step 'I should see milestone "v2.3"' do
milestone = @project.milestones.find_by(title: "v2.3") milestone = @project.milestones.find_by(title: "v2.3")
page.should have_content(milestone.title[0..10]) page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at) page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues") page.should have_content("Browse Issues")
end end
And 'project "Shop" has milestone "v2.2"' do step 'project "Shop" has milestone "v2.2"' do
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
milestone = create(:milestone, milestone = create(:milestone,
title: "v2.2", title: "v2.2",
...@@ -41,7 +41,7 @@ class ProjectMilestones < Spinach::FeatureSteps ...@@ -41,7 +41,7 @@ class ProjectMilestones < Spinach::FeatureSteps
3.times { create(:issue, project: project, milestone: milestone) } 3.times { create(:issue, project: project, milestone: milestone) }
end end
Given 'the milestone has open and closed issues' do step 'the milestone has open and closed issues' do
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
milestone = project.milestones.find_by(title: 'v2.2') milestone = project.milestones.find_by(title: 'v2.2')
...@@ -53,7 +53,7 @@ class ProjectMilestones < Spinach::FeatureSteps ...@@ -53,7 +53,7 @@ class ProjectMilestones < Spinach::FeatureSteps
click_link 'All Issues' click_link 'All Issues'
end end
Then "I should see 3 issues" do step 'I should see 3 issues' do
page.should have_selector('#tab-issues li.issue-row', count: 4) page.should have_selector('#tab-issues li.issue-row', count: 4)
end end
end end
...@@ -3,7 +3,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -3,7 +3,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedProject include SharedProject
Then 'page should have network graph' do step 'page should have network graph' do
page.should have_selector ".network-graph" page.should have_selector ".network-graph"
end end
...@@ -15,15 +15,15 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -15,15 +15,15 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
visit project_network_path(project, "master") visit project_network_path(project, "master")
end end
And 'page should select "master" in select box' do step 'page should select "master" in select box' do
page.should have_selector '.select2-chosen', text: "master" page.should have_selector '.select2-chosen', text: "master"
end end
And 'page should select "v1.0.0" in select box' do step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0" page.should have_selector '.select2-chosen', text: "v1.0.0"
end end
And 'page should have "master" on graph' do step 'page should have "master" on graph' do
within '.network-graph' do within '.network-graph' do
page.should have_content 'master' page.should have_content 'master'
end end
...@@ -44,27 +44,27 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -44,27 +44,27 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep 2 sleep 2
end end
Then 'page should have content not containing "v1.0.0"' do step 'page should have content not containing "v1.0.0"' do
within '.network-graph' do within '.network-graph' do
page.should have_content 'Change some files' page.should have_content 'Change some files'
end end
end end
Then 'page should not have content not containing "v1.0.0"' do step 'page should not have content not containing "v1.0.0"' do
within '.network-graph' do within '.network-graph' do
page.should_not have_content 'Change some files' page.should_not have_content 'Change some files'
end end
end end
And 'page should select "feature" in select box' do step 'page should select "feature" in select box' do
page.should have_selector '.select2-chosen', text: "feature" page.should have_selector '.select2-chosen', text: "feature"
end end
And 'page should select "v1.0.0" in select box' do step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0" page.should have_selector '.select2-chosen', text: "v1.0.0"
end end
And 'page should have "feature" on graph' do step 'page should have "feature" on graph' do
within '.network-graph' do within '.network-graph' do
page.should have_content 'feature' page.should have_content 'feature'
end end
...@@ -78,7 +78,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps ...@@ -78,7 +78,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep 2 sleep 2
end end
And 'page should have "v1.0.0" on graph' do step 'page should have "v1.0.0" on graph' do
within '.network-graph' do within '.network-graph' do
page.should have_content 'v1.0.0' page.should have_content 'v1.0.0'
end end
......
...@@ -4,7 +4,7 @@ class ProjectSnippets < Spinach::FeatureSteps ...@@ -4,7 +4,7 @@ class ProjectSnippets < Spinach::FeatureSteps
include SharedNote include SharedNote
include SharedPaths include SharedPaths
And 'project "Shop" have "Snippet one" snippet' do step 'project "Shop" have "Snippet one" snippet' do
create(:project_snippet, create(:project_snippet,
title: "Snippet one", title: "Snippet one",
content: "Test content", content: "Test content",
...@@ -13,7 +13,7 @@ class ProjectSnippets < Spinach::FeatureSteps ...@@ -13,7 +13,7 @@ class ProjectSnippets < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
And 'project "Shop" have no "Snippet two" snippet' do step 'project "Shop" have no "Snippet two" snippet' do
create(:snippet, create(:snippet,
title: "Snippet two", title: "Snippet two",
content: "Test content", content: "Test content",
...@@ -21,37 +21,37 @@ class ProjectSnippets < Spinach::FeatureSteps ...@@ -21,37 +21,37 @@ class ProjectSnippets < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
Given 'I click link "New Snippet"' do step 'I click link "New Snippet"' do
click_link "Add new snippet" click_link "Add new snippet"
end end
Given 'I click link "Snippet one"' do step 'I click link "Snippet one"' do
click_link "Snippet one" click_link "Snippet one"
end end
Then 'I should see "Snippet one" in snippets' do step 'I should see "Snippet one" in snippets' do
page.should have_content "Snippet one" page.should have_content "Snippet one"
end end
And 'I should not see "Snippet two" in snippets' do step 'I should not see "Snippet two" in snippets' do
page.should_not have_content "Snippet two" page.should_not have_content "Snippet two"
end end
And 'I should not see "Snippet one" in snippets' do step 'I should not see "Snippet one" in snippets' do
page.should_not have_content "Snippet one" page.should_not have_content "Snippet one"
end end
And 'I click link "Edit"' do step 'I click link "Edit"' do
within ".file-title" do within ".file-title" do
click_link "Edit" click_link "Edit"
end end
end end
And 'I click link "Remove Snippet"' do step 'I click link "Remove Snippet"' do
click_link "remove" click_link "remove"
end end
And 'I submit new snippet "Snippet three"' do step 'I submit new snippet "Snippet three"' do
fill_in "project_snippet_title", :with => "Snippet three" fill_in "project_snippet_title", :with => "Snippet three"
fill_in "project_snippet_file_name", :with => "my_snippet.rb" fill_in "project_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do within('.file-editor') do
...@@ -60,32 +60,32 @@ class ProjectSnippets < Spinach::FeatureSteps ...@@ -60,32 +60,32 @@ class ProjectSnippets < Spinach::FeatureSteps
click_button "Create snippet" click_button "Create snippet"
end end
Then 'I should see snippet "Snippet three"' do step 'I should see snippet "Snippet three"' do
page.should have_content "Snippet three" page.should have_content "Snippet three"
page.should have_content "Content of snippet three" page.should have_content "Content of snippet three"
end end
And 'I submit new title "Snippet new title"' do step 'I submit new title "Snippet new title"' do
fill_in "project_snippet_title", :with => "Snippet new title" fill_in "project_snippet_title", :with => "Snippet new title"
click_button "Save" click_button "Save"
end end
Then 'I should see "Snippet new title"' do step 'I should see "Snippet new title"' do
page.should have_content "Snippet new title" page.should have_content "Snippet new title"
end end
And 'I leave a comment like "Good snippet!"' do step 'I leave a comment like "Good snippet!"' do
within('.js-main-target-form') do within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!" fill_in "note_note", with: "Good snippet!"
click_button "Add Comment" click_button "Add Comment"
end end
end end
Then 'I should see comment "Good snippet!"' do step 'I should see comment "Good snippet!"' do
page.should have_content "Good snippet!" page.should have_content "Good snippet!"
end end
And 'I visit snippet page "Snippet one"' do step 'I visit snippet page "Snippet one"' do
visit project_snippet_path(project, project_snippet) visit project_snippet_path(project, project_snippet)
end end
......
...@@ -4,22 +4,22 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -4,22 +4,22 @@ class ProjectTeamManagement < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include Select2Helper include Select2Helper
Then 'I should be able to see myself in team' do step 'I should be able to see myself in team' do
page.should have_content(@user.name) page.should have_content(@user.name)
page.should have_content(@user.username) page.should have_content(@user.username)
end end
And 'I should see "Sam" in team list' do step 'I should see "Sam" in team list' do
user = User.find_by(name: "Sam") user = User.find_by(name: "Sam")
page.should have_content(user.name) page.should have_content(user.name)
page.should have_content(user.username) page.should have_content(user.username)
end end
Given 'I click link "New Team Member"' do step 'I click link "New Team Member"' do
click_link "New project member" click_link "New project member"
end end
And 'I select "Mike" as "Reporter"' do step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike") user = User.find_by(name: "Mike")
select2(user.id, from: "#user_ids", multiple: true) select2(user.id, from: "#user_ids", multiple: true)
...@@ -29,67 +29,67 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -29,67 +29,67 @@ class ProjectTeamManagement < Spinach::FeatureSteps
click_button "Add users" click_button "Add users"
end end
Then 'I should see "Mike" in team list as "Reporter"' do step 'I should see "Mike" in team list as "Reporter"' do
within ".access-reporter" do within ".access-reporter" do
page.should have_content('Mike') page.should have_content('Mike')
end end
end end
Given 'I should see "Sam" in team list as "Developer"' do step 'I should see "Sam" in team list as "Developer"' do
within ".access-developer" do within ".access-developer" do
page.should have_content('Sam') page.should have_content('Sam')
end end
end end
And 'I change "Sam" role to "Reporter"' do step 'I change "Sam" role to "Reporter"' do
user = User.find_by(name: "Sam") user = User.find_by(name: "Sam")
within "#user_#{user.id}" do within "#user_#{user.id}" do
select "Reporter", from: "team_member_project_access" select "Reporter", from: "team_member_project_access"
end end
end end
And 'I should see "Sam" in team list as "Reporter"' do step 'I should see "Sam" in team list as "Reporter"' do
within ".access-reporter" do within ".access-reporter" do
page.should have_content('Sam') page.should have_content('Sam')
end end
end end
And 'I click link "Remove from team"' do step 'I click link "Remove from team"' do
click_link "Remove from team" click_link "Remove from team"
end end
And 'I should not see "Sam" in team list' do step 'I should not see "Sam" in team list' do
user = User.find_by(name: "Sam") user = User.find_by(name: "Sam")
page.should_not have_content(user.name) page.should_not have_content(user.name)
page.should_not have_content(user.username) page.should_not have_content(user.username)
end end
And 'gitlab user "Mike"' do step 'gitlab user "Mike"' do
create(:user, name: "Mike") create(:user, name: "Mike")
end end
And 'gitlab user "Sam"' do step 'gitlab user "Sam"' do
create(:user, name: "Sam") create(:user, name: "Sam")
end end
And '"Sam" is "Shop" developer' do step '"Sam" is "Shop" developer' do
user = User.find_by(name: "Sam") user = User.find_by(name: "Sam")
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
project.team << [user, :developer] project.team << [user, :developer]
end end
Given 'I own project "Website"' do step 'I own project "Website"' do
@project = create(:empty_project, name: "Website", namespace: @user.namespace) @project = create(:empty_project, name: "Website", namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
And '"Mike" is "Website" reporter' do step '"Mike" is "Website" reporter' do
user = User.find_by(name: "Mike") user = User.find_by(name: "Mike")
project = Project.find_by(name: "Website") project = Project.find_by(name: "Website")
project.team << [user, :reporter] project.team << [user, :reporter]
end end
And 'I click link "Import team from another project"' do step 'I click link "Import team from another project"' do
click_link "Import members from another project" click_link "Import members from another project"
end end
......
...@@ -4,23 +4,23 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -4,23 +4,23 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include SharedNote include SharedNote
include SharedPaths include SharedPaths
Given 'I click on the Cancel button' do step 'I click on the Cancel button' do
within(:css, ".form-actions") do within(:css, ".form-actions") do
click_on "Cancel" click_on "Cancel"
end end
end end
Then 'I should be redirected back to the Edit Home Wiki page' do step 'I should be redirected back to the Edit Home Wiki page' do
url = URI.parse(current_url) url = URI.parse(current_url)
url.path.should == project_wiki_path(project, :home) url.path.should == project_wiki_path(project, :home)
end end
Given 'I create the Wiki Home page' do step 'I create the Wiki Home page' do
fill_in "wiki_content", with: '[link test](test)' fill_in "wiki_content", with: '[link test](test)'
click_on "Create page" click_on "Create page"
end end
Then 'I should see the newly created wiki page' do step 'I should see the newly created wiki page' do
page.should have_content "Home" page.should have_content "Home"
page.should have_content "link test" page.should have_content "link test"
...@@ -28,74 +28,74 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -28,74 +28,74 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
page.should have_content "Editing" page.should have_content "Editing"
end end
Given 'I have an existing Wiki page' do step 'I have an existing Wiki page' do
wiki.create_page("existing", "content", :markdown, "first commit") wiki.create_page("existing", "content", :markdown, "first commit")
@page = wiki.find_page("existing") @page = wiki.find_page("existing")
end end
And 'I browse to that Wiki page' do step 'I browse to that Wiki page' do
visit project_wiki_path(project, @page) visit project_wiki_path(project, @page)
end end
And 'I click on the Edit button' do step 'I click on the Edit button' do
click_on "Edit" click_on "Edit"
end end
And 'I change the content' do step 'I change the content' do
fill_in "Content", with: 'Updated Wiki Content' fill_in "Content", with: 'Updated Wiki Content'
click_on "Save changes" click_on "Save changes"
end end
Then 'I should see the updated content' do step 'I should see the updated content' do
page.should have_content "Updated Wiki Content" page.should have_content "Updated Wiki Content"
end end
Then 'I should be redirected back to that Wiki page' do step 'I should be redirected back to that Wiki page' do
url = URI.parse(current_url) url = URI.parse(current_url)
url.path.should == project_wiki_path(project, @page) url.path.should == project_wiki_path(project, @page)
end end
And 'That page has two revisions' do step 'That page has two revisions' do
@page.update("new content", :markdown, "second commit") @page.update("new content", :markdown, "second commit")
end end
And 'I click the History button' do step 'I click the History button' do
click_on "History" click_on "History"
end end
Then 'I should see both revisions' do step 'I should see both revisions' do
page.should have_content current_user.name page.should have_content current_user.name
page.should have_content "first commit" page.should have_content "first commit"
page.should have_content "second commit" page.should have_content "second commit"
end end
And 'I click on the "Delete this page" button' do step 'I click on the "Delete this page" button' do
click_on "Delete this page" click_on "Delete this page"
end end
Then 'The page should be deleted' do step 'The page should be deleted' do
page.should have_content "Page was successfully deleted" page.should have_content "Page was successfully deleted"
end end
And 'I click on the "Pages" button' do step 'I click on the "Pages" button' do
click_on "Pages" click_on "Pages"
end end
Then 'I should see the existing page in the pages list' do step 'I should see the existing page in the pages list' do
page.should have_content current_user.name page.should have_content current_user.name
page.should have_content @page.title page.should have_content @page.title
end end
Given 'I have an existing Wiki page with images linked on page' do step 'I have an existing Wiki page with images linked on page' do
wiki.create_page("pictures", "Look at this [image](image.jpg)\n\n ![image](image.jpg)", :markdown, "first commit") wiki.create_page("pictures", "Look at this [image](image.jpg)\n\n ![image](image.jpg)", :markdown, "first commit")
@wiki_page = wiki.find_page("pictures") @wiki_page = wiki.find_page("pictures")
end end
And 'I browse to wiki page with images' do step 'I browse to wiki page with images' do
visit project_wiki_path(project, @wiki_page) visit project_wiki_path(project, @wiki_page)
end end
And 'I click on existing image link' do step 'I click on existing image link' do
file = Gollum::File.new(wiki.wiki) file = Gollum::File.new(wiki.wiki)
Gollum::Wiki.any_instance.stub(:file).with("image.jpg", "master", true).and_return(file) Gollum::Wiki.any_instance.stub(:file).with("image.jpg", "master", true).and_return(file)
Gollum::File.any_instance.stub(:mime_type).and_return("image/jpeg") Gollum::File.any_instance.stub(:mime_type).and_return("image/jpeg")
...@@ -103,7 +103,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -103,7 +103,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
click_on "image" click_on "image"
end end
Then 'I should see the image from wiki repo' do step 'I should see the image from wiki repo' do
url = URI.parse(current_url) url = URI.parse(current_url)
url.path.should match("wikis/image.jpg") url.path.should match("wikis/image.jpg")
page.should_not have_xpath('/html') # Page should render the image which means there is no html involved page.should_not have_xpath('/html') # Page should render the image which means there is no html involved
...@@ -111,16 +111,16 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -111,16 +111,16 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
Gollum::File.any_instance.unstub(:mime_type) Gollum::File.any_instance.unstub(:mime_type)
end end
Then 'Image should be shown on the page' do step 'Image should be shown on the page' do
page.should have_xpath("//img[@src=\"image.jpg\"]") page.should have_xpath("//img[@src=\"image.jpg\"]")
end end
And 'I click on image link' do step 'I click on image link' do
page.should have_link('image', href: "image.jpg") page.should have_link('image', href: "image.jpg")
click_on "image" click_on "image"
end end
Then 'I should see the new wiki page form' do step 'I should see the new wiki page form' do
url = URI.parse(current_url) url = URI.parse(current_url)
url.path.should match("wikis/image.jpg") url.path.should match("wikis/image.jpg")
page.should have_content('New Wiki Page') page.should have_content('New Wiki Page')
......
...@@ -13,15 +13,15 @@ module SharedActiveTab ...@@ -13,15 +13,15 @@ module SharedActiveTab
page.find('div.content ul.nav-stacked-menu li.active').should have_content(content) page.find('div.content ul.nav-stacked-menu li.active').should have_content(content)
end end
And 'no other main tabs should be active' do step 'no other main tabs should be active' do
page.should have_selector('.main-nav li.active', count: 1) page.should have_selector('.main-nav li.active', count: 1)
end end
And 'no other sub tabs should be active' do step 'no other sub tabs should be active' do
page.should have_selector('div.content ul.nav-tabs li.active', count: 1) page.should have_selector('div.content ul.nav-tabs li.active', count: 1)
end end
And 'no other sub navs should be active' do step 'no other sub navs should be active' do
page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1) page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
end end
......
module SharedAdmin module SharedAdmin
include Spinach::DSL include Spinach::DSL
And 'there are projects in system' do step 'there are projects in system' do
2.times { create(:project) } 2.times { create(:project) }
end end
And 'system has users' do step 'system has users' do
2.times { create(:user) } 2.times { create(:user) }
end end
end end
......
...@@ -4,11 +4,11 @@ module SharedAuthentication ...@@ -4,11 +4,11 @@ module SharedAuthentication
include Spinach::DSL include Spinach::DSL
include LoginHelpers include LoginHelpers
Given 'I sign in as a user' do step 'I sign in as a user' do
login_as :user login_as :user
end end
Given 'I sign in as an admin' do step 'I sign in as an admin' do
login_as :admin login_as :admin
end end
......
...@@ -2,24 +2,24 @@ module SharedDiffNote ...@@ -2,24 +2,24 @@ module SharedDiffNote
include Spinach::DSL include Spinach::DSL
include RepoHelpers include RepoHelpers
Given 'I cancel the diff comment' do step 'I cancel the diff comment' do
within(diff_file_selector) do within(diff_file_selector) do
find(".js-close-discussion-note-form").click find(".js-close-discussion-note-form").click
end end
end end
Given 'I delete a diff comment' do step 'I delete a diff comment' do
find('.note').hover find('.note').hover
find(".js-note-delete").click find(".js-note-delete").click
end end
Given 'I haven\'t written any diff comment text' do step 'I haven\'t written any diff comment text' do
within(diff_file_selector) do within(diff_file_selector) do
fill_in "note[note]", with: "" fill_in "note[note]", with: ""
end end
end end
Given 'I leave a diff comment like "Typo, please fix"' do step 'I leave a diff comment like "Typo, please fix"' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix" fill_in "note[note]", with: "Typo, please fix"
...@@ -28,7 +28,7 @@ module SharedDiffNote ...@@ -28,7 +28,7 @@ module SharedDiffNote
end end
end end
Given 'I preview a diff comment text like "Should fix it :smile:"' do step 'I preview a diff comment text like "Should fix it :smile:"' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:" fill_in "note[note]", with: "Should fix it :smile:"
...@@ -36,7 +36,7 @@ module SharedDiffNote ...@@ -36,7 +36,7 @@ module SharedDiffNote
end end
end end
Given 'I preview another diff comment text like "DRY this up"' do step 'I preview another diff comment text like "DRY this up"' do
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_commit.del_line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
...@@ -45,109 +45,109 @@ module SharedDiffNote ...@@ -45,109 +45,109 @@ module SharedDiffNote
end end
end end
Given 'I open a diff comment form' do step 'I open a diff comment form' do
click_diff_line(sample_commit.line_code) click_diff_line(sample_commit.line_code)
end end
Given 'I open another diff comment form' do step 'I open another diff comment form' do
click_diff_line(sample_commit.del_line_code) click_diff_line(sample_commit.del_line_code)
end end
Given 'I write a diff comment like ":-1: I don\'t like this"' do step 'I write a diff comment like ":-1: I don\'t like this"' do
within(diff_file_selector) do within(diff_file_selector) do
fill_in "note[note]", with: ":-1: I don\'t like this" fill_in "note[note]", with: ":-1: I don\'t like this"
end end
end end
Given 'I submit the diff comment' do step 'I submit the diff comment' do
within(diff_file_selector) do within(diff_file_selector) do
click_button("Add Comment") click_button("Add Comment")
end end
end end
Then 'I should not see the diff comment form' do step 'I should not see the diff comment form' do
within(diff_file_selector) do within(diff_file_selector) do
page.should_not have_css("form.new_note") page.should_not have_css("form.new_note")
end end
end end
Then 'I should not see the diff comment preview button' do step 'I should not see the diff comment preview button' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: false) page.should have_css(".js-note-preview-button", visible: false)
end end
end end
Then 'I should not see the diff comment text field' do step 'I should not see the diff comment text field' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-note-text", visible: false) page.should have_css(".js-note-text", visible: false)
end end
end end
Then 'I should only see one diff form' do step 'I should only see one diff form' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css("form.new_note", count: 1) page.should have_css("form.new_note", count: 1)
end end
end end
Then 'I should see a diff comment form with ":-1: I don\'t like this"' do step 'I should see a diff comment form with ":-1: I don\'t like this"' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_field("note[note]", with: ":-1: I don\'t like this") page.should have_field("note[note]", with: ":-1: I don\'t like this")
end end
end end
Then 'I should see a diff comment saying "Typo, please fix"' do step 'I should see a diff comment saying "Typo, please fix"' do
within("#{diff_file_selector} .note") do within("#{diff_file_selector} .note") do
page.should have_content("Typo, please fix") page.should have_content("Typo, please fix")
end end
end end
Then 'I should see a discussion reply button' do step 'I should see a discussion reply button' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_link("Reply") page.should have_link("Reply")
end end
end end
Then 'I should see a temporary diff comment form' do step 'I should see a temporary diff comment form' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-temp-notes-holder form.new_note") page.should have_css(".js-temp-notes-holder form.new_note")
end end
end end
Then 'I should see add a diff comment button' do step 'I should see add a diff comment button' do
page.should have_css(".js-add-diff-note-button", visible: false) page.should have_css(".js-add-diff-note-button", visible: false)
end end
Then 'I should see an empty diff comment form' do step 'I should see an empty diff comment form' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_field("note[note]", with: "") page.should have_field("note[note]", with: "")
end end
end end
Then 'I should see the cancel comment button' do step 'I should see the cancel comment button' do
within("#{diff_file_selector} form") do within("#{diff_file_selector} form") do
page.should have_css(".js-close-discussion-note-form", text: "Cancel") page.should have_css(".js-close-discussion-note-form", text: "Cancel")
end end
end end
Then 'I should see the diff comment preview' do step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do within("#{diff_file_selector} form") do
page.should have_css(".js-note-preview", visible: false) page.should have_css(".js-note-preview", visible: false)
end end
end end
Then 'I should see the diff comment edit button' do step 'I should see the diff comment edit button' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-note-write-button", visible: true) page.should have_css(".js-note-write-button", visible: true)
end end
end end
Then 'I should see the diff comment preview button' do step 'I should see the diff comment preview button' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: true) page.should have_css(".js-note-preview-button", visible: true)
end end
end end
Then 'I should see two separate previews' do step 'I should see two separate previews' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_css(".js-note-preview", visible: true, count: 2) page.should have_css(".js-note-preview", visible: true, count: 2)
page.should have_content("Should fix it") page.should have_content("Should fix it")
......
module SharedNote module SharedNote
include Spinach::DSL include Spinach::DSL
Given 'I delete a comment' do step 'I delete a comment' do
find('.note').hover find('.note').hover
find(".js-note-delete").click find(".js-note-delete").click
end end
Given 'I haven\'t written any comment text' do step 'I haven\'t written any comment text' do
within(".js-main-target-form") do within(".js-main-target-form") do
fill_in "note[note]", with: "" fill_in "note[note]", with: ""
end end
end end
Given 'I leave a comment like "XML attached"' do step 'I leave a comment like "XML attached"' do
within(".js-main-target-form") do within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached" fill_in "note[note]", with: "XML attached"
click_button "Add Comment" click_button "Add Comment"
...@@ -20,84 +20,84 @@ module SharedNote ...@@ -20,84 +20,84 @@ module SharedNote
end end
end end
Given 'I preview a comment text like "Bug fixed :smile:"' do step 'I preview a comment text like "Bug fixed :smile:"' do
within(".js-main-target-form") do within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:" fill_in "note[note]", with: "Bug fixed :smile:"
find(".js-note-preview-button").trigger("click") find(".js-note-preview-button").trigger("click")
end end
end end
Given 'I submit the comment' do step 'I submit the comment' do
within(".js-main-target-form") do within(".js-main-target-form") do
click_button "Add Comment" click_button "Add Comment"
end end
end end
Given 'I write a comment like "Nice"' do step 'I write a comment like "Nice"' do
within(".js-main-target-form") do within(".js-main-target-form") do
fill_in "note[note]", with: "Nice" fill_in "note[note]", with: "Nice"
end end
end end
Then 'I should not see a comment saying "XML attached"' do step 'I should not see a comment saying "XML attached"' do
page.should_not have_css(".note") page.should_not have_css(".note")
end end
Then 'I should not see the cancel comment button' do step 'I should not see the cancel comment button' do
within(".js-main-target-form") do within(".js-main-target-form") do
should_not have_link("Cancel") should_not have_link("Cancel")
end end
end end
Then 'I should not see the comment preview' do step 'I should not see the comment preview' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-preview", visible: false) page.should have_css(".js-note-preview", visible: false)
end end
end end
Then 'I should not see the comment preview button' do step 'I should not see the comment preview button' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-preview-button", visible: false) page.should have_css(".js-note-preview-button", visible: false)
end end
end end
Then 'I should not see the comment text field' do step 'I should not see the comment text field' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-text", visible: false) page.should have_css(".js-note-text", visible: false)
end end
end end
Then 'I should see a comment saying "XML attached"' do step 'I should see a comment saying "XML attached"' do
within(".note") do within(".note") do
page.should have_content("XML attached") page.should have_content("XML attached")
end end
end end
Then 'I should see an empty comment text field' do step 'I should see an empty comment text field' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_field("note[note]", with: "") page.should have_field("note[note]", with: "")
end end
end end
Then 'I should see the comment edit button' do step 'I should see the comment edit button' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-write-button", visible: true) page.should have_css(".js-note-write-button", visible: true)
end end
end end
Then 'I should see the comment preview' do step 'I should see the comment preview' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-preview", visible: true) page.should have_css(".js-note-preview", visible: true)
end end
end end
Then 'I should see the comment preview button' do step 'I should see the comment preview button' do
within(".js-main-target-form") do within(".js-main-target-form") do
page.should have_css(".js-note-preview-button", visible: true) page.should have_css(".js-note-preview-button", visible: true)
end end
end end
Then 'I should see comment "XML attached"' do step 'I should see comment "XML attached"' do
within(".note") do within(".note") do
page.should have_content("XML attached") page.should have_content("XML attached")
end end
......
...@@ -394,15 +394,15 @@ module SharedPaths ...@@ -394,15 +394,15 @@ module SharedPaths
# Snippets # Snippets
# ---------------------------------------- # ----------------------------------------
Given 'I visit project "Shop" snippets page' do step 'I visit project "Shop" snippets page' do
visit project_snippets_path(project) visit project_snippets_path(project)
end end
Given 'I visit snippets page' do step 'I visit snippets page' do
visit snippets_path visit snippets_path
end end
Given 'I visit new snippet page' do step 'I visit new snippet page' do
visit new_snippet_path visit new_snippet_path
end end
...@@ -418,7 +418,7 @@ module SharedPaths ...@@ -418,7 +418,7 @@ module SharedPaths
# Errors # Errors
# ---------------------------------------- # ----------------------------------------
Then 'page status code should be 404' do step 'page status code should be 404' do
page.status_code.should == 404 page.status_code.should == 404
end end
end end
...@@ -2,33 +2,33 @@ module SharedProject ...@@ -2,33 +2,33 @@ module SharedProject
include Spinach::DSL include Spinach::DSL
# Create a project without caring about what it's called # Create a project without caring about what it's called
And "I own a project" do step "I own a project" do
@project = create(:project, namespace: @user.namespace) @project = create(:project, namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
# Create a specific project called "Shop" # Create a specific project called "Shop"
And 'I own project "Shop"' do step 'I own project "Shop"' do
@project = Project.find_by(name: "Shop") @project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true) @project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
# Create another specific project called "Forum" # Create another specific project called "Forum"
And 'I own project "Forum"' do step 'I own project "Forum"' do
@project = Project.find_by(name: "Forum") @project = Project.find_by(name: "Forum")
@project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project') @project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project')
@project.team << [@user, :master] @project.team << [@user, :master]
end end
# Create an empty project without caring about the name # Create an empty project without caring about the name
And 'I own an empty project' do step 'I own an empty project' do
@project = create(:empty_project, @project = create(:empty_project,
name: 'Empty Project', namespace: @user.namespace) name: 'Empty Project', namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
And 'project "Shop" has push event' do step 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop") @project = Project.find_by(name: "Shop")
data = { data = {
...@@ -54,12 +54,12 @@ module SharedProject ...@@ -54,12 +54,12 @@ module SharedProject
) )
end end
Then 'I should see project "Shop" activity feed' do step 'I should see project "Shop" activity feed' do
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}" page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}"
end end
Then 'I should see project settings' do step 'I should see project settings' do
current_path.should == edit_project_path(@project) current_path.should == edit_project_path(@project)
page.should have_content("Project name") page.should have_content("Project name")
page.should have_content("Features:") page.should have_content("Features:")
......
module SharedSnippet module SharedSnippet
include Spinach::DSL include Spinach::DSL
And 'I have public "Personal snippet one" snippet' do step 'I have public "Personal snippet one" snippet' do
create(:personal_snippet, create(:personal_snippet,
title: "Personal snippet one", title: "Personal snippet one",
content: "Test content", content: "Test content",
...@@ -10,7 +10,7 @@ module SharedSnippet ...@@ -10,7 +10,7 @@ module SharedSnippet
author: current_user) author: current_user)
end end
And 'I have private "Personal snippet private" snippet' do step 'I have private "Personal snippet private" snippet' do
create(:personal_snippet, create(:personal_snippet,
title: "Personal snippet private", title: "Personal snippet private",
content: "Provate content", content: "Provate content",
...@@ -18,7 +18,7 @@ module SharedSnippet ...@@ -18,7 +18,7 @@ module SharedSnippet
private: true, private: true,
author: current_user) author: current_user)
end end
And 'I have a public many lined snippet' do step 'I have a public many lined snippet' do
create(:personal_snippet, create(:personal_snippet,
title: 'Many lined snippet', title: 'Many lined snippet',
content: <<-END.gsub(/^\s+\|/, ''), content: <<-END.gsub(/^\s+\|/, ''),
......
...@@ -37,19 +37,19 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps ...@@ -37,19 +37,19 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps
page.should_not have_content 'line three' page.should_not have_content 'line three'
end end
Then 'I should see "Personal snippet one" in results' do step 'I should see "Personal snippet one" in results' do
page.should have_content 'Personal snippet one' page.should have_content 'Personal snippet one'
end end
And 'I should see "Personal snippet private" in results' do step 'I should see "Personal snippet private" in results' do
page.should have_content 'Personal snippet private' page.should have_content 'Personal snippet private'
end end
Then 'I should not see "Personal snippet one" in results' do step 'I should not see "Personal snippet one" in results' do
page.should_not have_content 'Personal snippet one' page.should_not have_content 'Personal snippet one'
end end
And 'I should not see "Personal snippet private" in results' do step 'I should not see "Personal snippet private" in results' do
page.should_not have_content 'Personal snippet private' page.should_not have_content 'Personal snippet private'
end end
......
...@@ -3,11 +3,11 @@ class DiscoverSnippets < Spinach::FeatureSteps ...@@ -3,11 +3,11 @@ class DiscoverSnippets < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedSnippet include SharedSnippet
Then 'I should see "Personal snippet one" in snippets' do step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one" page.should have_content "Personal snippet one"
end end
And 'I should not see "Personal snippet private" in snippets' do step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private" page.should_not have_content "Personal snippet private"
end end
......
...@@ -4,25 +4,25 @@ class SnippetsFeature < Spinach::FeatureSteps ...@@ -4,25 +4,25 @@ class SnippetsFeature < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedSnippet include SharedSnippet
Given 'I click link "Personal snippet one"' do step 'I click link "Personal snippet one"' do
click_link "Personal snippet one" click_link "Personal snippet one"
end end
And 'I should not see "Personal snippet one" in snippets' do step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one" page.should_not have_content "Personal snippet one"
end end
And 'I click link "Edit"' do step 'I click link "Edit"' do
within ".file-title" do within ".file-title" do
click_link "Edit" click_link "Edit"
end end
end end
And 'I click link "Destroy"' do step 'I click link "Destroy"' do
click_link "remove" click_link "remove"
end end
And 'I submit new snippet "Personal snippet three"' do step 'I submit new snippet "Personal snippet three"' do
fill_in "personal_snippet_title", :with => "Personal snippet three" fill_in "personal_snippet_title", :with => "Personal snippet three"
fill_in "personal_snippet_file_name", :with => "my_snippet.rb" fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do within('.file-editor') do
...@@ -31,30 +31,30 @@ class SnippetsFeature < Spinach::FeatureSteps ...@@ -31,30 +31,30 @@ class SnippetsFeature < Spinach::FeatureSteps
click_button "Create snippet" click_button "Create snippet"
end end
Then 'I should see snippet "Personal snippet three"' do step 'I should see snippet "Personal snippet three"' do
page.should have_content "Personal snippet three" page.should have_content "Personal snippet three"
page.should have_content "Content of snippet three" page.should have_content "Content of snippet three"
end end
And 'I submit new title "Personal snippet new title"' do step 'I submit new title "Personal snippet new title"' do
fill_in "personal_snippet_title", :with => "Personal snippet new title" fill_in "personal_snippet_title", :with => "Personal snippet new title"
click_button "Save" click_button "Save"
end end
Then 'I should see "Personal snippet new title"' do step 'I should see "Personal snippet new title"' do
page.should have_content "Personal snippet new title" page.should have_content "Personal snippet new title"
end end
And 'I uncheck "Private" checkbox' do step 'I uncheck "Private" checkbox' do
choose "Public" choose "Public"
click_button "Save" click_button "Save"
end end
Then 'I should see "Personal snippet one" public' do step 'I should see "Personal snippet one" public' do
page.should have_no_xpath("//i[@class='public-snippet']") page.should have_no_xpath("//i[@class='public-snippet']")
end end
And 'I visit snippet page "Personal snippet one"' do step 'I visit snippet page "Personal snippet one"' do
visit snippet_path(snippet) visit snippet_path(snippet)
end end
......
...@@ -3,33 +3,33 @@ class UserSnippets < Spinach::FeatureSteps ...@@ -3,33 +3,33 @@ class UserSnippets < Spinach::FeatureSteps
include SharedPaths include SharedPaths
include SharedSnippet include SharedSnippet
Given 'I visit my snippets page' do step 'I visit my snippets page' do
visit user_snippets_path(current_user) visit user_snippets_path(current_user)
end end
Then 'I should see "Personal snippet one" in snippets' do step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one" page.should have_content "Personal snippet one"
end end
And 'I should see "Personal snippet private" in snippets' do step 'I should see "Personal snippet private" in snippets' do
page.should have_content "Personal snippet private" page.should have_content "Personal snippet private"
end end
Then 'I should not see "Personal snippet one" in snippets' do step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one" page.should_not have_content "Personal snippet one"
end end
And 'I should not see "Personal snippet private" in snippets' do step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private" page.should_not have_content "Personal snippet private"
end end
Given 'I click "Public" filter' do step 'I click "Public" filter' do
within('.nav-stacked') do within('.nav-stacked') do
click_link "Public" click_link "Public"
end end
end end
Given 'I click "Private" filter' do step 'I click "Private" filter' do
within('.nav-stacked') do within('.nav-stacked') do
click_link "Private" click_link "Private"
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