Commit 8949758f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rs-expect-syntax-features' into 'master'

Prepare feature steps for RSpec 3

See merge request !803
parents b07cf118 4c42fc7c
......@@ -8,7 +8,7 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps
end
step 'I should see application form' do
page.should have_content "New application"
expect(page).to have_content "New application"
end
step 'I fill application form out and submit' do
......@@ -18,9 +18,9 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps
end
step 'I see application' do
page.should have_content "Application: test"
page.should have_content "Application Id"
page.should have_content "Secret"
expect(page).to have_content "Application: test"
expect(page).to have_content "Application Id"
expect(page).to have_content "Secret"
end
step 'I click edit' do
......@@ -28,28 +28,28 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps
end
step 'I see edit application form' do
page.should have_content "Edit application"
expect(page).to have_content "Edit application"
end
step 'I change name of application and submit' do
page.should have_content "Edit application"
expect(page).to have_content "Edit application"
fill_in :doorkeeper_application_name, with: 'test_changed'
click_on "Submit"
end
step 'I see that application was changed' do
page.should have_content "test_changed"
page.should have_content "Application Id"
page.should have_content "Secret"
expect(page).to have_content "test_changed"
expect(page).to have_content "Application Id"
expect(page).to have_content "Secret"
end
step 'I click to remove application' do
within '.oauth-applications' do
page.within '.oauth-applications' do
click_on "Destroy"
end
end
step "I see that application is removed" do
page.find(".oauth-applications").should_not have_content "test_changed"
expect(page.find(".oauth-applications")).not_to have_content "test_changed"
end
end
......@@ -8,7 +8,7 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
end
step 'I should be all broadcast messages' do
page.should have_content "Migration to new server"
expect(page).to have_content "Migration to new server"
end
step 'submit form with new broadcast message' do
......@@ -18,11 +18,11 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
end
step 'I should be redirected to admin messages page' do
current_path.should == admin_broadcast_messages_path
expect(current_path).to eq admin_broadcast_messages_path
end
step 'I should see newly created broadcast message' do
page.should have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
end
step 'submit form with new customized broadcast message' do
......@@ -35,7 +35,7 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
end
step 'I should see a customized broadcast message' do
page.should have_content 'Application update from 4:00 CST to 5:00 CST'
page.should have_selector %(div[style="background-color:#f2dede;color:#b94a48"])
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_selector %(div[style="background-color:#f2dede;color:#b94a48"])
end
end
......@@ -10,7 +10,7 @@ class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps
step 'I should see all public deploy keys' do
DeployKey.are_public.each do |p|
page.should have_content p.title
expect(page).to have_content p.title
end
end
......@@ -33,11 +33,11 @@ class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps
end
step 'I should be on admin deploy keys page' do
current_path.should == admin_deploy_keys_path
expect(current_path).to eq admin_deploy_keys_path
end
step 'I should see newly created deploy key' do
page.should have_content(deploy_key.title)
expect(page).to have_content(deploy_key.title)
end
def deploy_key
......
......@@ -28,32 +28,32 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
step 'I should see newly created group' do
page.should have_content "Group: gitlab"
page.should have_content "Group description"
expect(page).to have_content "Group: gitlab"
expect(page).to have_content "Group description"
end
step 'I should be redirected to group page' do
current_path.should == admin_group_path(Group.find_by(path: 'gitlab'))
expect(current_path).to eq admin_group_path(Group.find_by(path: 'gitlab'))
end
When 'I select user "John Doe" from user list as "Reporter"' do
select2(user_john.id, from: "#user_ids", multiple: true)
within "#new_project_member" do
page.within "#new_project_member" do
select "Reporter", from: "access_level"
end
click_button "Add users to group"
end
step 'I should see "John Doe" in team list in every project as "Reporter"' do
within ".group-users-list" do
page.should have_content "John Doe"
page.should have_content "Reporter"
page.within ".group-users-list" do
expect(page).to have_content "John Doe"
expect(page).to have_content "Reporter"
end
end
step 'I should be all groups' do
Group.all.each do |group|
page.should have_content group.name
expect(page).to have_content group.name
end
end
......@@ -62,14 +62,14 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
step 'I remove user "John Doe" from group' do
within "#user_#{user_john.id}" do
page.within "#user_#{user_john.id}" do
click_link 'Remove user from group'
end
end
step 'I should not see "John Doe" in team list' do
within ".group-users-list" do
page.should_not have_content "John Doe"
page.within ".group-users-list" do
expect(page).not_to have_content "John Doe"
end
end
......
......@@ -4,8 +4,8 @@ class Spinach::Features::AdminLogs < Spinach::FeatureSteps
include SharedAdmin
step 'I should see tabs with available logs' do
page.should have_content 'production.log'
page.should have_content 'githost.log'
page.should have_content 'application.log'
expect(page).to have_content 'production.log'
expect(page).to have_content 'githost.log'
expect(page).to have_content 'application.log'
end
end
......@@ -5,7 +5,7 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps
step 'I should see all projects' do
Project.all.each do |p|
page.should have_content p.name_with_namespace
expect(page).to have_content p.name_with_namespace
end
end
......@@ -15,9 +15,9 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps
step 'I should see project details' do
project = Project.first
current_path.should == admin_namespace_project_path(project.namespace, project)
page.should have_content(project.name_with_namespace)
page.should have_content(project.creator.name)
expect(current_path).to eq admin_namespace_project_path(project.namespace, project)
expect(page).to have_content(project.name_with_namespace)
expect(page).to have_content(project.creator.name)
end
step 'I visit admin project page' do
......@@ -34,8 +34,8 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps
end
step 'I should see project transfered' do
page.should have_content 'Web / ' + project.name
page.should have_content 'Namespace: Web'
expect(page).to have_content 'Web / ' + project.name
expect(page).to have_content 'Namespace: Web'
end
def project
......
......@@ -11,9 +11,9 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps
end
step 'I should see application settings saved' do
current_application_settings.gravatar_enabled.should be_false
current_application_settings.home_page_url.should == 'https://about.gitlab.com/'
page.should have_content 'Application settings saved successfully'
expect(current_application_settings.gravatar_enabled).to be_false
expect(current_application_settings.home_page_url).to eq 'https://about.gitlab.com/'
expect(page).to have_content 'Application settings saved successfully'
end
step 'I click on "Service Templates"' do
......@@ -41,18 +41,18 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps
end
step 'I should see service template settings saved' do
page.should have_content 'Application settings saved successfully'
expect(page).to have_content 'Application settings saved successfully'
end
step 'I should see all checkboxes checked' do
all('input[type=checkbox]').each do |checkbox|
checkbox.should be_checked
page.all('input[type=checkbox]').each do |checkbox|
expect(checkbox).to be_checked
end
end
step 'I should see Slack settings saved' do
find_field('Webhook').value.should eq 'http://localhost'
find_field('Username').value.should eq 'test_user'
find_field('Channel').value.should eq '#test_channel'
expect(find_field('Webhook').value).to eq 'http://localhost'
expect(find_field('Username').value).to eq 'test_user'
expect(find_field('Channel').value).to eq '#test_channel'
end
end
......@@ -5,7 +5,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
step 'I should see all users' do
User.all.each do |user|
page.should have_content user.name
expect(page).to have_content user.name
end
end
......@@ -23,13 +23,13 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'See username error message' do
within "#error_explanation" do
page.should have_content "Username"
page.within "#error_explanation" do
expect(page).to have_content "Username"
end
end
step 'Not changed form action url' do
page.should have_selector %(form[action="/admin/users/#{@user.username}"])
expect(page).to have_selector %(form[action="/admin/users/#{@user.username}"])
end
step 'I submit modified user' do
......@@ -38,7 +38,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I see user attributes changed' do
page.should have_content 'Can create groups: Yes'
expect(page).to have_content 'Can create groups: Yes'
end
step 'click edit on my user' do
......@@ -53,7 +53,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I see the secondary email' do
page.should have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}"
expect(page).to have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}"
end
step 'I click remove secondary email' do
......@@ -61,7 +61,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I should not see secondary email anymore' do
page.should_not have_content "Secondary email:"
expect(page).not_to have_content "Secondary email:"
end
step 'user "Mike" with groups and projects' do
......@@ -79,8 +79,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I should see user "Mike" details' do
page.should have_content 'Account'
page.should have_content 'Personal projects limit'
expect(page).to have_content 'Account'
expect(page).to have_content 'Personal projects limit'
end
step 'user "Pete" with ssh keys' do
......@@ -94,8 +94,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I should see key list' do
page.should have_content 'ssh-rsa Key2'
page.should have_content 'ssh-rsa Key1'
expect(page).to have_content 'ssh-rsa Key2'
expect(page).to have_content 'ssh-rsa Key1'
end
step 'I click on the key title' do
......@@ -103,8 +103,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I should see key details' do
page.should have_content 'ssh-rsa Key2'
page.should have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2'
expect(page).to have_content 'ssh-rsa Key2'
expect(page).to have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2'
end
step 'I click on remove key' do
......@@ -112,6 +112,6 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
end
step 'I should see the key removed' do
page.should_not have_content 'ssh-rsa Key2'
expect(page).not_to have_content 'ssh-rsa Key2'
end
end
......@@ -9,14 +9,14 @@ class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps
end
step 'I should see "Shop" project link' do
page.should have_link "Shop"
expect(page).to have_link "Shop"
end
step 'I should not see "Forum" project link' do
page.should_not have_link "Forum"
expect(page).not_to have_link "Forum"
end
step 'I should see "Forum" project link' do
page.should have_link "Forum"
expect(page).to have_link "Forum"
end
end
......@@ -4,16 +4,16 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
include SharedProject
step 'I should see "New Project" link' do
page.should have_link "New project"
expect(page).to have_link "New project"
end
step 'I should see "Shop" project link' do
page.should have_link "Shop"
expect(page).to have_link "Shop"
end
step 'I should see last push widget' do
page.should have_content "You pushed to fix"
page.should have_link "Create Merge Request"
expect(page).to have_content "You pushed to fix"
expect(page).to have_link "Create Merge Request"
end
step 'I click "Create Merge Request" link' do
......@@ -21,10 +21,10 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end
step 'I see prefilled new Merge Request page' do
current_path.should == new_namespace_project_merge_request_path(@project.namespace, @project)
find("#merge_request_target_project_id").value.should == @project.id.to_s
find("input#merge_request_source_branch").value.should == "fix"
find("input#merge_request_target_branch").value.should == "master"
expect(current_path).to eq new_namespace_project_merge_request_path(@project.namespace, @project)
expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s
expect(find("input#merge_request_source_branch").value).to eq "fix"
expect(find("input#merge_request_target_branch").value).to eq "master"
end
step 'user with name "John Doe" joined project "Shop"' do
......@@ -38,7 +38,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end
step 'I should see "John Doe joined project Shop" event' do
page.should have_content "John Doe joined project #{project.name_with_namespace}"
expect(page).to have_content "John Doe joined project #{project.name_with_namespace}"
end
step 'user with name "John Doe" left project "Shop"' do
......@@ -51,7 +51,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end
step 'I should see "John Doe left project Shop" event' do
page.should have_content "John Doe left project #{project.name_with_namespace}"
expect(page).to have_content "John Doe left project #{project.name_with_namespace}"
end
step 'I have group with projects' do
......@@ -64,13 +64,13 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
step 'I should see projects list' do
@user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace
expect(page).to have_link project.name_with_namespace
end
end
step 'I should see groups list' do
Group.all.each do |group|
page.should have_link group.name
expect(page).to have_link group.name
end
end
......@@ -80,6 +80,6 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end
step 'I should see 1 project at group list' do
find('span.last_activity/span').should have_content('1')
expect(find('span.last_activity/span')).to have_content('1')
end
end
......@@ -4,27 +4,27 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps
include SharedProject
step 'I should see push event' do
page.should have_selector('span.pushed')
expect(page).to have_selector('span.pushed')
end
step 'I should not see push event' do
page.should_not have_selector('span.pushed')
expect(page).not_to have_selector('span.pushed')
end
step 'I should see new member event' do
page.should have_selector('span.joined')
expect(page).to have_selector('span.joined')
end
step 'I should not see new member event' do
page.should_not have_selector('span.joined')
expect(page).not_to have_selector('span.joined')
end
step 'I should see merge request event' do
page.should have_selector('span.accepted')
expect(page).to have_selector('span.accepted')
end
step 'I should not see merge request event' do
page.should_not have_selector('span.accepted')
expect(page).not_to have_selector('span.accepted')
end
step 'this project has push event' do
......
......@@ -17,29 +17,29 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps
end
step 'I should not see the "Leave" button for group "Owned"' do
find(:css, 'li', text: "Owner").should_not have_selector(:css, 'i.fa.fa-sign-out')
expect(find(:css, 'li', text: "Owner")).not_to have_selector(:css, 'i.fa.fa-sign-out')
# poltergeist always confirms popups.
end
step 'I should not see the "Leave" button for groupr "Guest"' do
find(:css, 'li', text: "Guest").should_not have_selector(:css, 'i.fa.fa-sign-out')
expect(find(:css, 'li', text: "Guest")).not_to have_selector(:css, 'i.fa.fa-sign-out')
# poltergeist always confirms popups.
end
step 'I should see group "Owned" in group list' do
page.should have_content("Owned")
expect(page).to have_content("Owned")
end
step 'I should not see group "Owned" in group list' do
page.should_not have_content("Owned")
expect(page).not_to have_content("Owned")
end
step 'I should see group "Guest" in group list' do
page.should have_content("Guest")
expect(page).to have_content("Guest")
end
step 'I should not see group "Guest" in group list' do
page.should_not have_content("Guest")
expect(page).not_to have_content("Guest")
end
step 'I click new group link' do
......@@ -53,15 +53,15 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps
end
step 'I should be redirected to group "Samurai" page' do
current_path.should == group_path(Group.find_by(name: 'Samurai'))
expect(current_path).to eq group_path(Group.find_by(name: 'Samurai'))
end
step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
expect(page).to have_content "Samurai"
expect(page).to have_content "Tokugawa Shogunate"
end
step 'I should see the "Can not leave message"' do
page.should have_content "You can not leave Owned group because you're the last owner"
expect(page).to have_content "You can not leave Owned group because you're the last owner"
end
end
......@@ -12,7 +12,7 @@ class Spinach::Features::DashboardHelp < Spinach::FeatureSteps
end
step 'I should see "Rake Tasks" page markdown rendered' do
page.should have_content "Gather information about GitLab and the system it runs on"
expect(page).to have_content "Gather information about GitLab and the system it runs on"
end
step 'Header "Rebuild project satellites" should have correct ids and links' do
......
......@@ -46,11 +46,11 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end
def should_see(issue)
page.should have_content(issue.title[0..10])
expect(page).to have_content(issue.title[0..10])
end
def should_not_see(issue)
page.should_not have_content(issue.title[0..10])
expect(page).not_to have_content(issue.title[0..10])
end
def assigned_issue
......
......@@ -50,11 +50,11 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
end
def should_see(merge_request)
page.should have_content(merge_request.title[0..10])
expect(page).to have_content(merge_request.title[0..10])
end
def should_not_see(merge_request)
page.should_not have_content(merge_request.title[0..10])
expect(page).not_to have_content(merge_request.title[0..10])
end
def assigned_merge_request
......
......@@ -4,13 +4,13 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
include SharedProject
step 'I click "New project" link' do
within('.content') do
page.within('.content') do
click_link "New project"
end
end
step 'I see "New project" page' do
page.should have_content("Project path")
expect(page).to have_content("Project path")
end
step 'I click on "Import project from GitHub"' do
......@@ -19,11 +19,11 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
step 'I see instructions on how to import from GitHub' do
github_modal = first('.modal-body')
github_modal.should be_visible
github_modal.should have_content "To enable importing projects from GitHub"
expect(github_modal).to be_visible
expect(github_modal).to have_content "To enable importing projects from GitHub"
all('.modal-body').each do |element|
element.should_not be_visible unless element == github_modal
page.all('.modal-body').each do |element|
expect(element).not_to be_visible unless element == github_modal
end
end
end
......@@ -8,8 +8,8 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps
end
step 'I should not see project "Shop"' do
within 'aside' do
page.should_not have_content('Shop')
page.within 'aside' do
expect(page).not_to have_content('Shop')
end
end
end
......@@ -39,19 +39,19 @@ class Spinach::Features::ExploreGroups < Spinach::FeatureSteps
end
step 'I should not see project "Enterprise" items' do
page.should_not have_content "Enterprise"
expect(page).not_to have_content "Enterprise"
end
step 'I should see project "Internal" items' do
page.should have_content "Internal"
expect(page).to have_content "Internal"
end
step 'I should not see project "Internal" items' do
page.should_not have_content "Internal"
expect(page).not_to have_content "Internal"
end
step 'I should see project "Community" items' do
page.should have_content "Community"
expect(page).to have_content "Community"
end
step 'I change filter to Everyone\'s' do
......@@ -59,11 +59,11 @@ class Spinach::Features::ExploreGroups < Spinach::FeatureSteps
end
step 'I should see group member "John Doe"' do
page.should have_content "John Doe"
expect(page).to have_content "John Doe"
end
step 'I should not see member roles' do
body.should_not match(%r{owner|developer|reporter|guest}i)
expect(body).not_to match(%r{owner|developer|reporter|guest}i)
end
protected
......
......@@ -4,56 +4,56 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
include SharedProject
step 'I should see project "Empty Public Project"' do
page.should have_content "Empty Public Project"
expect(page).to have_content "Empty Public Project"
end
step 'I should see public project details' do
page.should have_content '32 branches'
page.should have_content '16 tags'
expect(page).to have_content '32 branches'
expect(page).to have_content '16 tags'
end
step 'I should see project readme' do
page.should have_content 'README.md'
expect(page).to have_content 'README.md'
end
step 'I should see empty public project details' do
page.should have_content 'Git global setup'
expect(page).to have_content 'Git global setup'
end
step 'I should see empty public project details with http clone info' do
project = Project.find_by(name: 'Empty Public Project')
all(:css, '.git-empty .clone').each do |element|
element.text.should include(project.http_url_to_repo)
page.all(:css, '.git-empty .clone').each do |element|
expect(element.text).to include(project.http_url_to_repo)
end
end
step 'I should see empty public project details with ssh clone info' do
project = Project.find_by(name: 'Empty Public Project')
all(:css, '.git-empty .clone').each do |element|
element.text.should include(project.url_to_repo)
page.all(:css, '.git-empty .clone').each do |element|
expect(element.text).to include(project.url_to_repo)
end
end
step 'I should see project "Community" home page' do
within '.navbar-gitlab .title' do
page.should have_content 'Community'
page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Community'
end
end
step 'I should see project "Internal" home page' do
within '.navbar-gitlab .title' do
page.should have_content 'Internal'
page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Internal'
end
end
step 'I should see an http link to the repository' do
project = Project.find_by(name: 'Community')
page.should have_field('project_clone', with: project.http_url_to_repo)
expect(page).to have_field('project_clone', with: project.http_url_to_repo)
end
step 'I should see an ssh link to the repository' do
project = Project.find_by(name: 'Community')
page.should have_field('project_clone', with: project.url_to_repo)
expect(page).to have_field('project_clone', with: project.url_to_repo)
end
step 'I visit "Community" issues page' do
......@@ -70,9 +70,9 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
step 'I should see list of issues for "Community" project' do
page.should have_content "Bug"
page.should have_content public_project.name
page.should have_content "New feature"
expect(page).to have_content "Bug"
expect(page).to have_content public_project.name
expect(page).to have_content "New feature"
end
step 'I visit "Internal" issues page' do
......@@ -89,9 +89,9 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
step 'I should see list of issues for "Internal" project' do
page.should have_content "Internal Bug"
page.should have_content internal_project.name
page.should have_content "New internal feature"
expect(page).to have_content "Internal Bug"
expect(page).to have_content internal_project.name
expect(page).to have_content "New internal feature"
end
step 'I visit "Community" merge requests page' do
......@@ -107,8 +107,8 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
end
step 'I should see list of merge requests for "Community" project' do
page.should have_content public_project.name
page.should have_content public_merge_request.source_project.name
expect(page).to have_content public_project.name
expect(page).to have_content public_merge_request.source_project.name
end
step 'I visit "Internal" merge requests page' do
......@@ -124,8 +124,8 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
end
step 'I should see list of merge requests for "Internal" project' do
page.should have_content internal_project.name
page.should have_content internal_merge_request.source_project.name
expect(page).to have_content internal_project.name
expect(page).to have_content internal_merge_request.source_project.name
end
def internal_project
......
......@@ -16,7 +16,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike")
within ".users-group-form" do
page.within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -25,14 +25,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see "Mike" in team list as "Reporter"' do
within '.well-list' do
page.should have_content('Mike')
page.should have_content('Reporter')
page.within '.well-list' do
expect(page).to have_content('Mike')
expect(page).to have_content('Reporter')
end
end
step 'I select "sjobs@apple.com" as "Reporter"' do
within ".users-group-form" do
page.within ".users-group-form" do
select2("sjobs@apple.com", from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -41,39 +41,39 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
within '.well-list' do
page.should have_content('sjobs@apple.com')
page.should have_content('invited')
page.should have_content('Reporter')
page.within '.well-list' do
expect(page).to have_content('sjobs@apple.com')
expect(page).to have_content('invited')
expect(page).to have_content('Reporter')
end
end
step 'I should see group "Owned" projects list' do
Group.find_by(name: "Owned").projects.each do |project|
page.should have_link project.name
expect(page).to have_link project.name
end
end
step 'I should see projects activity feed' do
page.should have_content 'closed issue'
expect(page).to have_content 'closed issue'
end
step 'I should see issues from group "Owned" assigned to me' do
assigned_to_me(:issues).each do |issue|
page.should have_content issue.title
expect(page).to have_content issue.title
end
end
step 'I should see merge requests from group "Owned" assigned to me' do
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
expect(page).to have_content issue.title[0..80]
end
end
step 'I select user "Mary Jane" from list with role "Reporter"' do
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_button 'Add members'
within ".users-group-form" do
page.within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -82,22 +82,22 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I should see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("John Doe")
expect(projects_with_access).to have_content("John Doe")
end
step 'I should not see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("John Doe")
expect(projects_with_access).not_to have_content("John Doe")
end
step 'I should see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("Mary Jane")
expect(projects_with_access).to have_content("Mary Jane")
end
step 'I should not see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("Mary Jane")
expect(projects_with_access).not_to have_content("Mary Jane")
end
step 'project from group "Owned" has issues assigned to me' do
......@@ -122,8 +122,8 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do
page.should have_content "new-name"
page.within ".navbar-gitlab" do
expect(page).to have_content "new-name"
end
end
......@@ -134,12 +134,12 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see new group "Owned" avatar' do
Group.find_by(name: "Owned").avatar.should be_instance_of AvatarUploader
Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
expect(Group.find_by(name: "Owned").avatar).to be_instance_of AvatarUploader
expect(Group.find_by(name: "Owned").avatar.url).to eq "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
end
step 'I should see the "Remove avatar" button' do
page.should have_link("Remove avatar")
expect(page).to have_link("Remove avatar")
end
step 'I have group "Owned" avatar' do
......@@ -154,11 +154,11 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should not see group "Owned" avatar' do
Group.find_by(name: "Owned").avatar?.should be_false
expect(Group.find_by(name: "Owned").avatar?).to be_false
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link("Remove avatar")
expect(page).not_to have_link("Remove avatar")
end
step 'I click on the "Remove User From Group" button for "John Doe"' do
......@@ -172,17 +172,17 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should not see the "Remove User From Group" button for "John Doe"' do
find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove')
expect(find(:css, 'li', text: "John Doe")).not_to have_selector(:css, 'a.btn-remove')
# poltergeist always confirms popups.
end
step 'I should not see the "Remove User From Group" button for "Mary Jane"' do
find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove')
expect(find(:css, 'li', text: "Mary Jane")).not_to have_selector(:css, 'a.btn-remove')
# poltergeist always confirms popups.
end
step 'I search for \'Mary\' member' do
within '.member-search-form' do
page.within '.member-search-form' do
fill_in 'search', with: 'Mary'
click_button 'Search'
end
......@@ -193,7 +193,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see group milestones index page has no milestones' do
page.should have_content('No milestones to show')
expect(page).to have_content('No milestones to show')
end
step 'Group has projects with milestones' do
......@@ -201,10 +201,10 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see group milestones index page with milestones' do
page.should have_content('Version 7.2')
page.should have_content('GL-113')
page.should have_link('2 Issues', href: issues_group_path("owned", milestone_title: "Version 7.2"))
page.should have_link('3 Merge Requests', href: merge_requests_group_path("owned", milestone_title: "GL-113"))
expect(page).to have_content('Version 7.2')
expect(page).to have_content('GL-113')
expect(page).to have_link('2 Issues', href: issues_group_path("owned", milestone_title: "Version 7.2"))
expect(page).to have_link('3 Merge Requests', href: merge_requests_group_path("owned", milestone_title: "GL-113"))
end
step 'I click on one group milestone' do
......@@ -212,14 +212,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see group milestone with descriptions and expiry date' do
page.should have_content('expires at Aug 20, 2114')
expect(page).to have_content('expires at Aug 20, 2114')
end
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
page.should have_content('Milestone GL-113')
page.should have_content('Progress: 0 closed – 4 open')
page.should have_link(@issue1.title, href: namespace_project_issue_path(@project1.namespace, @project1, @issue1))
page.should have_link(@mr3.title, href: namespace_project_merge_request_path(@project3.namespace, @project3, @mr3))
expect(page).to have_content('Milestone GL-113')
expect(page).to have_content('Progress: 0 closed – 4 open')
expect(page).to have_link(@issue1.title, href: namespace_project_issue_path(@project1.namespace, @project1, @issue1))
expect(page).to have_link(@mr3.title, href: namespace_project_merge_request_path(@project3.namespace, @project3, @mr3))
end
protected
......
......@@ -6,9 +6,9 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps
end
step 'I should see my emails' do
page.should have_content(@user.email)
expect(page).to have_content(@user.email)
@user.emails.each do |email|
page.should have_content(email.email)
expect(page).to have_content(email.email)
end
end
......@@ -19,14 +19,14 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps
step 'I should see new email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com")
email.should_not be_nil
page.should have_content("my@email.com")
expect(email).not_to be_nil
expect(page).to have_content("my@email.com")
end
step 'I should not see email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com")
email.should be_nil
page.should_not have_content("my@email.com")
expect(email).to be_nil
expect(page).not_to have_content("my@email.com")
end
step 'I click link "Remove" for "my@email.com"' do
......@@ -43,6 +43,6 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps
step 'I should not have @user.email added' do
email = @user.emails.find_by(email: @user.email)
email.should be_nil
expect(email).to be_nil
end
end
......@@ -7,6 +7,6 @@ class Spinach::Features::ProfileNotifications < Spinach::FeatureSteps
end
step 'I should see global notifications settings' do
page.should have_content "Notifications"
expect(page).to have_content "Notifications"
end
end
......@@ -3,7 +3,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
include SharedPaths
step 'I should see my profile info' do
page.should have_content "This information will appear on your profile"
expect(page).to have_content "This information will appear on your profile"
end
step 'I change my profile info' do
......@@ -23,7 +23,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
expect(@user.twitter).to eq 'testtwitter'
expect(@user.website_url).to eq 'testurl'
expect(@user.bio).to eq 'I <3 GitLab'
find('#user_location').value.should == 'Ukraine'
expect(find('#user_location').value).to eq 'Ukraine'
end
step 'I change my avatar' do
......@@ -33,12 +33,12 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see new avatar' do
@user.avatar.should be_instance_of AvatarUploader
@user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
expect(@user.avatar).to be_instance_of AvatarUploader
expect(@user.avatar.url).to eq "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png"
end
step 'I should see the "Remove avatar" button' do
page.should have_link("Remove avatar")
expect(page).to have_link("Remove avatar")
end
step 'I have an avatar' do
......@@ -53,15 +53,15 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see my gravatar' do
@user.avatar?.should be_false
expect(@user.avatar?).to be_false
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link("Remove avatar")
expect(page).not_to have_link("Remove avatar")
end
step 'I try change my password w/o old one' do
within '.update-password' do
page.within '.update-password' do
fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344"
click_button "Save"
......@@ -69,7 +69,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I change my password' do
within '.update-password' do
page.within '.update-password' do
fill_in "user_current_password", with: "12345678"
fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344"
......@@ -78,7 +78,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I unsuccessfully change my password' do
within '.update-password' do
page.within '.update-password' do
fill_in "user_current_password", with: "12345678"
fill_in "user_password", with: "password"
fill_in "user_password_confirmation", with: "confirmation"
......@@ -87,23 +87,23 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step "I should see a missing password error message" do
page.should have_content "You must provide a valid current password"
expect(page).to have_content "You must provide a valid current password"
end
step "I should see a password error message" do
page.should have_content "Password confirmation doesn't match"
expect(page).to have_content "Password confirmation doesn't match"
end
step 'I reset my token' do
within '.update-token' do
page.within '.update-token' do
@old_token = @user.private_token
click_button "Reset"
end
end
step 'I should see new token' do
find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token
expect(find("#token").value).not_to eq @old_token
expect(find("#token").value).to eq @user.reload.private_token
end
step 'I have activity' do
......@@ -111,28 +111,28 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see my activity' do
page.should have_content "#{current_user.name} closed issue"
expect(page).to have_content "#{current_user.name} closed issue"
end
step "I change my application theme" do
within '.application-theme' do
page.within '.application-theme' do
choose "Violet"
end
end
step "I change my code preview theme" do
within '.code-preview-theme' do
page.within '.code-preview-theme' do
choose "Solarized dark"
end
end
step "I should see the theme change immediately" do
page.should have_selector('body.ui_color')
page.should_not have_selector('body.ui_basic')
expect(page).to have_selector('body.ui_color')
expect(page).not_to have_selector('body.ui_basic')
end
step "I should receive feedback that the changes were saved" do
page.should have_content("saved")
expect(page).to have_content("saved")
end
step 'my password is expired' do
......@@ -141,11 +141,11 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step "I am not an ldap user" do
current_user.identities.delete
current_user.ldap_user?.should be_false
expect(current_user.ldap_user?).to be_false
end
step 'I redirected to expired password page' do
current_path.should == new_profile_password_path
expect(current_path).to eq new_profile_password_path
end
step 'I submit new password' do
......@@ -156,15 +156,15 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I redirected to sign in page' do
current_path.should == new_user_session_path
expect(current_path).to eq new_user_session_path
end
step 'I should be redirected to password page' do
current_path.should == edit_profile_password_path
expect(current_path).to eq edit_profile_password_path
end
step 'I should be redirected to account page' do
current_path.should == profile_account_path
expect(current_path).to eq profile_account_path
end
step 'I click on my profile picture' do
......@@ -172,10 +172,10 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see my user page' do
page.should have_content "User Activity"
expect(page).to have_content "User Activity"
within '.navbar-gitlab' do
page.should have_content current_user.name
page.within '.navbar-gitlab' do
expect(page).to have_content current_user.name
end
end
......@@ -189,7 +189,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see groups I belong to' do
page.should have_css('.profile-groups-avatars', visible: true)
expect(page).to have_css('.profile-groups-avatars', visible: true)
end
step 'I click on new application button' do
......@@ -197,7 +197,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I should see application form' do
page.should have_content "New application"
expect(page).to have_content "New application"
end
step 'I fill application form out and submit' do
......@@ -207,9 +207,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I see application' do
page.should have_content "Application: test"
page.should have_content "Application Id"
page.should have_content "Secret"
expect(page).to have_content "Application: test"
expect(page).to have_content "Application Id"
expect(page).to have_content "Secret"
end
step 'I click edit' do
......@@ -217,28 +217,28 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
step 'I see edit application form' do
page.should have_content "Edit application"
expect(page).to have_content "Edit application"
end
step 'I change name of application and submit' do
page.should have_content "Edit application"
expect(page).to have_content "Edit application"
fill_in :doorkeeper_application_name, with: 'test_changed'
click_on "Submit"
end
step 'I see that application was changed' do
page.should have_content "test_changed"
page.should have_content "Application Id"
page.should have_content "Secret"
expect(page).to have_content "test_changed"
expect(page).to have_content "Application Id"
expect(page).to have_content "Secret"
end
step 'I click to remove application' do
within '.oauth-applications' do
page.within '.oauth-applications' do
click_on "Destroy"
end
end
step "I see that application is removed" do
page.find(".oauth-applications").should_not have_content "test_changed"
expect(page.find(".oauth-applications")).not_to have_content "test_changed"
end
end
......@@ -3,7 +3,7 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
step 'I should see my ssh keys' do
@user.keys.each do |key|
page.should have_content(key.title)
expect(page).to have_content(key.title)
end
end
......@@ -19,9 +19,9 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
step 'I should see new ssh key "Laptop"' do
key = Key.find_by(title: "Laptop")
page.should have_content(key.title)
page.should have_content(key.key)
current_path.should == profile_key_path(key)
expect(page).to have_content(key.title)
expect(page).to have_content(key.key)
expect(current_path).to eq profile_key_path(key)
end
step 'I click link "Work"' do
......@@ -37,7 +37,7 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
end
step 'I should not see "Work" ssh key' do
page.should_not have_content "Work"
expect(page).not_to have_content "Work"
end
step 'I have ssh key "ssh-rsa Work"' do
......
......@@ -20,7 +20,7 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
end
step 'I click the "Edit" tab' do
within '.project-settings-nav' do
page.within '.project-settings-nav' do
click_link('Project')
end
end
......
......@@ -19,11 +19,11 @@ class Spinach::Features::ProjectArchived < Spinach::FeatureSteps
end
step 'I should not see "Archived"' do
page.should_not have_content "Archived"
expect(page).not_to have_content "Archived"
end
step 'I should see "Archived"' do
page.should have_content "Archived"
expect(page).to have_content "Archived"
end
When 'I set project archived' do
......
......@@ -8,8 +8,8 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
step 'I should see "Shop" all branches list' do
page.should have_content "Branches"
page.should have_content "master"
expect(page).to have_content "Branches"
expect(page).to have_content "master"
end
step 'I click link "Protected"' do
......@@ -17,9 +17,9 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
step 'I should see "Shop" protected branches list' do
within ".protected-branches-list" do
page.should have_content "stable"
page.should_not have_content "master"
page.within ".protected-branches-list" do
expect(page).to have_content "stable"
expect(page).not_to have_content "master"
end
end
......@@ -57,29 +57,29 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
step 'I should see new branch created' do
page.should have_content 'deploy_keys'
expect(page).to have_content 'deploy_keys'
end
step 'I should see new an error that branch is invalid' do
page.should have_content 'Branch name invalid'
expect(page).to have_content 'Branch name invalid'
end
step 'I should see new an error that ref is invalid' do
page.should have_content 'Invalid reference name'
expect(page).to have_content 'Invalid reference name'
end
step 'I should see new an error that branch already exists' do
page.should have_content 'Branch already exists'
expect(page).to have_content 'Branch already exists'
end
step "I click branch 'improve/awesome' delete link" do
within '.js-branch-improve\/awesome' do
page.within '.js-branch-improve\/awesome' do
find('.btn-remove').click
sleep 0.05
end
end
step "I should not see branch 'improve/awesome'" do
all(visible: true).should_not have_content 'improve/awesome'
expect(page.all(visible: true)).not_to have_content 'improve/awesome'
end
end
......@@ -6,9 +6,9 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
step 'I see project commits' do
commit = @project.repository.commit
page.should have_content(@project.name)
page.should have_content(commit.message[0..20])
page.should have_content(commit.short_id)
expect(page).to have_content(@project.name)
expect(page).to have_content(commit.message[0..20])
expect(page).to have_content(commit.short_id)
end
step 'I click atom feed link' do
......@@ -17,10 +17,10 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
step 'I see commits atom feed' do
commit = @project.repository.commit
response_headers['Content-Type'].should have_content("application/atom+xml")
body.should have_selector("title", text: "#{@project.name}:master commits")
body.should have_selector("author email", text: commit.author_email)
body.should have_selector("entry summary", text: commit.description[0..10])
expect(response_headers['Content-Type']).to have_content("application/atom+xml")
expect(body).to have_selector("title", text: "#{@project.name}:master commits")
expect(body).to have_selector("author email", text: commit.author_email)
expect(body).to have_selector("entry summary", text: commit.description[0..10])
end
step 'I click on commit link' do
......@@ -28,8 +28,8 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'I see commit info' do
page.should have_content sample_commit.message
page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
expect(page).to have_content sample_commit.message
expect(page).to have_content "Showing #{sample_commit.files_changed_count} changed files"
end
step 'I fill compare fields with refs' do
......@@ -45,27 +45,27 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'I should see additional file lines' do
within @diff.parent do
first('.new_line').text.should_not have_content "..."
page.within @diff.parent do
expect(first('.new_line').text).not_to have_content "..."
end
end
step 'I see compared refs' do
page.should have_content "Compare View"
page.should have_content "Commits (1)"
page.should have_content "Showing 2 changed files"
expect(page).to have_content "Compare View"
expect(page).to have_content "Commits (1)"
expect(page).to have_content "Showing 2 changed files"
end
step 'I see breadcrumb links' do
page.should have_selector('ul.breadcrumb')
page.should have_selector('ul.breadcrumb a', count: 4)
expect(page).to have_selector('ul.breadcrumb')
expect(page).to have_selector('ul.breadcrumb a', count: 4)
end
step 'I see commits stats' do
page.should have_content 'Top 50 Committers'
page.should have_content 'Committers'
page.should have_content 'Total commits'
page.should have_content 'Authors'
expect(page).to have_content 'Top 50 Committers'
expect(page).to have_content 'Committers'
expect(page).to have_content 'Total commits'
expect(page).to have_content 'Authors'
end
step 'I visit big commit page' do
......@@ -74,8 +74,8 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'I see big commit warning' do
page.should have_content sample_big_commit.message
page.should have_content "Too many changes"
expect(page).to have_content sample_big_commit.message
expect(page).to have_content "Too many changes"
end
step 'I visit a commit with an image that changed' do
......@@ -83,9 +83,9 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'The diff links to both the previous and current image' do
links = all('.two-up span div a')
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 = page.all('.two-up span div a')
expect(links[0]['href']).to match %r{blob/#{sample_image_commit.old_blob_id}}
expect(links[1]['href']).to match %r{blob/#{sample_image_commit.new_blob_id}}
end
step 'I click side-by-side diff button' do
......@@ -93,10 +93,10 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'I see side-by-side diff button' do
page.should have_content "Side-by-side"
expect(page).to have_content "Side-by-side"
end
step 'I see inline diff button' do
page.should have_content "Inline"
expect(page).to have_content "Inline"
end
end
......@@ -4,8 +4,8 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
include SharedPaths
step 'I should see "Shop" all tags list' do
page.should have_content "Tags"
page.should have_content "v1.0.0"
expect(page).to have_content "Tags"
expect(page).to have_content "v1.0.0"
end
step 'I click new tag link' do
......@@ -37,37 +37,37 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end
step 'I should see new tag created' do
page.should have_content 'v7.0'
expect(page).to have_content 'v7.0'
end
step 'I should see new an error that tag is invalid' do
page.should have_content 'Tag name invalid'
expect(page).to have_content 'Tag name invalid'
end
step 'I should see new an error that tag ref is invalid' do
page.should have_content 'Invalid reference name'
expect(page).to have_content 'Invalid reference name'
end
step 'I should see new an error that tag already exists' do
page.should have_content 'Tag already exists'
expect(page).to have_content 'Tag already exists'
end
step "I delete tag 'v1.1.0'" do
within '.tags' do
page.within '.tags' do
first('.btn-remove').click
sleep 0.05
end
end
step "I should not see tag 'v1.1.0'" do
within '.tags' do
all(visible: true).should_not have_content 'v1.1.0'
page.within '.tags' do
expect(page.all(visible: true)).not_to have_content 'v1.1.0'
end
end
step 'I delete all tags' do
within '.tags' do
all('.btn-remove').each do |remove|
page.within '.tags' do
page.all('.btn-remove').each do |remove|
remove.click
sleep 0.05
end
......@@ -75,8 +75,8 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
end
step 'I should see tags info message' do
within '.tags' do
page.should have_content 'Repository has no tags yet.'
page.within '.tags' do
expect(page).to have_content 'Repository has no tags yet.'
end
end
end
......@@ -29,9 +29,9 @@ class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps
def check_author_link(email, user)
author_link = find('.commit-author-link')
author_link['href'].should == user_path(user)
author_link['data-original-title'].should == email
find('.commit-author-name').text.should == user.name
expect(author_link['href']).to eq user_path(user)
expect(author_link['data-original-title']).to eq email
expect(find('.commit-author-name').text).to eq user.name
end
def user_primary
......
......@@ -8,20 +8,20 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
end
step 'I should see project page' do
page.should have_content "Empty"
current_path.should == namespace_project_path(Project.last.namespace, Project.last)
expect(page).to have_content "Empty"
expect(current_path).to eq namespace_project_path(Project.last.namespace, Project.last)
end
step 'I should see empty project instuctions' do
page.should have_content "git init"
page.should have_content "git remote"
page.should have_content Project.last.url_to_repo
expect(page).to have_content "git init"
expect(page).to have_content "git remote"
expect(page).to have_content Project.last.url_to_repo
end
step 'I see empty project instuctions' do
page.should have_content "git init"
page.should have_content "git remote"
page.should have_content Project.last.url_to_repo
expect(page).to have_content "git init"
expect(page).to have_content "git remote"
expect(page).to have_content Project.last.url_to_repo
end
step 'I click on HTTP' do
......@@ -29,7 +29,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
end
step 'Remote url should update to http link' do
page.should have_content "git remote add origin #{Project.last.http_url_to_repo}"
expect(page).to have_content "git remote add origin #{Project.last.http_url_to_repo}"
end
step 'If I click on SSH' do
......@@ -37,6 +37,6 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
end
step 'Remote url should update to ssh link' do
page.should have_content "git remote add origin #{Project.last.url_to_repo}"
expect(page).to have_content "git remote add origin #{Project.last.url_to_repo}"
end
end
......@@ -8,20 +8,20 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should see project deploy key' do
within '.enabled-keys' do
page.should have_content deploy_key.title
page.within '.enabled-keys' do
expect(page).to have_content deploy_key.title
end
end
step 'I should see other project deploy key' do
within '.available-keys' do
page.should have_content other_deploy_key.title
page.within '.available-keys' do
expect(page).to have_content other_deploy_key.title
end
end
step 'I should see public deploy key' do
within '.available-keys' do
page.should have_content public_deploy_key.title
page.within '.available-keys' do
expect(page).to have_content public_deploy_key.title
end
end
......@@ -36,12 +36,12 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should be on deploy keys page' do
current_path.should == namespace_project_deploy_keys_path(@project.namespace, @project)
expect(current_path).to eq namespace_project_deploy_keys_path(@project.namespace, @project)
end
step 'I should see newly created deploy key' do
within '.enabled-keys' do
page.should have_content(deploy_key.title)
page.within '.enabled-keys' do
expect(page).to have_content(deploy_key.title)
end
end
......@@ -56,8 +56,8 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should only see the same deploy key once' do
within '.available-keys' do
page.should have_selector('ul li', count: 1)
page.within '.available-keys' do
expect(page).to have_selector('ul li', count: 1)
end
end
......@@ -66,7 +66,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I click attach deploy key' do
within '.available-keys' do
page.within '.available-keys' do
click_link 'Enable'
end
end
......
......@@ -4,8 +4,8 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
include SharedProject
step 'I click link "Fork"' do
page.should have_content "Shop"
page.should have_content "Fork"
expect(page).to have_content "Shop"
expect(page).to have_content "Fork"
click_link "Fork"
end
......@@ -15,7 +15,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end
step 'I should see the forked project page' do
page.should have_content "Project was successfully forked."
expect(page).to have_content "Project was successfully forked."
end
step 'I already have a project named "Shop" in my namespace' do
......@@ -23,11 +23,11 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end
step 'I should see a "Name has already been taken" warning' do
page.should have_content "Name has already been taken"
expect(page).to have_content "Name has already been taken"
end
step 'I fork to my namespace' do
within '.fork-namespaces' do
page.within '.fork-namespaces' do
click_link current_user.name
end
end
......
......@@ -21,17 +21,17 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I should see merge request "Merge Request On Forked Project"' do
@project.merge_requests.size.should >= 1
expect(@project.merge_requests.size).to be >= 1
@merge_request = @project.merge_requests.last
current_path.should == namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
@merge_request.title.should == "Merge Request On Forked Project"
@merge_request.source_project.should == @forked_project
@merge_request.source_branch.should == "fix"
@merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
page.should have_content @merge_request.target_branch
expect(current_path).to eq namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
expect(@merge_request.title).to eq "Merge Request On Forked Project"
expect(@merge_request.source_project).to eq @forked_project
expect(@merge_request.source_branch).to eq "fix"
expect(@merge_request.target_branch).to eq "master"
expect(page).to have_content @forked_project.path_with_namespace
expect(page).to have_content @project.path_with_namespace
expect(page).to have_content @merge_request.source_branch
expect(page).to have_content @merge_request.target_branch
end
step 'I fill out a "Merge Request On Forked Project" merge request' do
......@@ -56,7 +56,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
step 'I should see the commit under the forked from project' do
commit = @project.repository.commit
page.should have_content(commit.message)
expect(page).to have_content(commit.message)
end
step 'I click "Create Merge Request on fork" link' do
......@@ -64,12 +64,12 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I see prefilled new Merge Request page for the forked project' do
current_path.should == new_namespace_project_merge_request_path(@forked_project.namespace, @forked_project)
find("#merge_request_source_project_id").value.should == @forked_project.id.to_s
find("#merge_request_target_project_id").value.should == @project.id.to_s
find("#merge_request_source_branch").value.should have_content "new_design"
find("#merge_request_target_branch").value.should have_content "master"
find("#merge_request_title").value.should == "New Design"
expect(current_path).to eq new_namespace_project_merge_request_path(@forked_project.namespace, @forked_project)
expect(find("#merge_request_source_project_id").value).to eq @forked_project.id.to_s
expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s
expect(find("#merge_request_source_branch").value).to have_content "new_design"
expect(find("#merge_request_target_branch").value).to have_content "master"
expect(find("#merge_request_title").value).to eq "New Design"
verify_commit_link(".mr_target_commit", @project)
verify_commit_link(".mr_source_commit", @forked_project)
end
......@@ -83,22 +83,22 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I should see the edited merge request' do
page.should have_content "An Edited Forked Merge Request"
@project.merge_requests.size.should >= 1
expect(page).to have_content "An Edited Forked Merge Request"
expect(@project.merge_requests.size).to be >= 1
@merge_request = @project.merge_requests.last
current_path.should == namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
@merge_request.source_project.should == @forked_project
@merge_request.source_branch.should == "fix"
@merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
page.should have_content @merge_request.target_branch
expect(current_path).to eq namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
expect(@merge_request.source_project).to eq @forked_project
expect(@merge_request.source_branch).to eq "fix"
expect(@merge_request.target_branch).to eq "master"
expect(page).to have_content @forked_project.path_with_namespace
expect(page).to have_content @project.path_with_namespace
expect(page).to have_content @merge_request.source_branch
expect(page).to have_content @merge_request.target_branch
end
step 'I should see last push widget' do
page.should have_content "You pushed to new_design"
page.should have_link "Create Merge Request"
expect(page).to have_content "You pushed to new_design"
expect(page).to have_link "Create Merge Request"
end
step 'I click link edit "Merge Request On Forked Project"' do
......@@ -106,26 +106,26 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I see the edit page prefilled for "Merge Request On Forked Project"' do
current_path.should == edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
page.should have_content "Edit merge request ##{@merge_request.id}"
find("#merge_request_title").value.should == "Merge Request On Forked Project"
expect(current_path).to eq edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
expect(page).to have_content "Edit merge request ##{@merge_request.id}"
expect(find("#merge_request_title").value).to eq "Merge Request On Forked Project"
end
step 'I fill out an invalid "Merge Request On Forked Project" merge request' do
select "Select branch", from: "merge_request_target_branch"
find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s
find(:select, "merge_request_source_branch", {}).value.should == ""
find(:select, "merge_request_target_branch", {}).value.should == ""
expect(find(:select, "merge_request_source_project_id", {}).value).to eq @forked_project.id.to_s
expect(find(:select, "merge_request_target_project_id", {}).value).to eq @project.id.to_s
expect(find(:select, "merge_request_source_branch", {}).value).to eq ""
expect(find(:select, "merge_request_target_branch", {}).value).to eq ""
click_button "Compare branches"
end
step 'I should see validation errors' do
page.should have_content "You must select source and target branch"
expect(page).to have_content "You must select source and target branch"
end
step 'the target repository should be the original repository' do
page.should have_select("merge_request_target_project_id", selected: @project.path_with_namespace)
expect(page).to have_select("merge_request_target_project_id", selected: @project.path_with_namespace)
end
step 'I click "Assign to" dropdown"' do
......@@ -139,13 +139,13 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
step 'I should see the users from the target project ID' do
expect(page).to have_selector('.user-result', visible: true, count: 2)
users = page.all('.user-name')
users[0].text.should == 'Unassigned'
users[1].text.should == @project.users.first.name
expect(users[0].text).to eq 'Unassigned'
expect(users[1].text).to eq @project.users.first.name
end
# Verify a link is generated against the correct project
def verify_commit_link(container_div, container_project)
# This should force a wait for the javascript to execute
find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit"
expect(find(:div,container_div).find(".commit_short_id")['href']).to have_content "#{container_project.path_with_namespace}/commit"
end
end
......@@ -3,7 +3,7 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
include SharedProject
step 'page should have graphs' do
page.should have_selector ".stat-graph"
expect(page).to have_selector ".stat-graph"
end
When 'I visit project "Shop" graph page' do
......@@ -17,7 +17,7 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
end
step 'page should have commits graphs' do
page.should have_content "Commit statistics for master"
page.should have_content "Commits per day of month"
expect(page).to have_content "Commit statistics for master"
expect(page).to have_content "Commits per day of month"
end
end
......@@ -19,7 +19,7 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps
end
step 'I should see project hook' do
page.should have_content @hook.url
expect(page).to have_content @hook.url
end
step 'I submit new hook' do
......@@ -29,8 +29,8 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps
end
step 'I should see newly created hook' do
current_path.should == namespace_project_hooks_path(current_project.namespace, current_project)
page.should have_content(@url)
expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project)
expect(page).to have_content(@url)
end
step 'I click test hook button' do
......@@ -44,19 +44,19 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps
end
step 'hook should be triggered' do
current_path.should == namespace_project_hooks_path(current_project.namespace, current_project)
page.should have_selector '.flash-notice',
expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project)
expect(page).to have_selector '.flash-notice',
text: 'Hook successfully executed.'
end
step 'I should see hook error message' do
page.should have_selector '.flash-alert',
expect(page).to have_selector '.flash-alert',
text: 'Hook execution failed. '\
'Ensure the project has commits.'
end
step 'I should see hook service down error message' do
page.should have_selector '.flash-alert',
expect(page).to have_selector '.flash-alert',
text: 'Hook execution failed. '\
'Ensure hook URL is correct and '\
'service is up.'
......
......@@ -5,26 +5,26 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
include Select2Helper
step 'I should see "Bugfix1" in issues list' do
within ".issues-list" do
page.should have_content "Bugfix1"
page.within ".issues-list" do
expect(page).to have_content "Bugfix1"
end
end
step 'I should see "Bugfix2" in issues list' do
within ".issues-list" do
page.should have_content "Bugfix2"
page.within ".issues-list" do
expect(page).to have_content "Bugfix2"
end
end
step 'I should not see "Bugfix2" in issues list' do
within ".issues-list" do
page.should_not have_content "Bugfix2"
page.within ".issues-list" do
expect(page).not_to have_content "Bugfix2"
end
end
step 'I should not see "Feature1" in issues list' do
within ".issues-list" do
page.should_not have_content "Feature1"
page.within ".issues-list" do
expect(page).not_to have_content "Feature1"
end
end
......@@ -33,7 +33,7 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
end
step 'I click link "feature"' do
within ".labels-filter" do
page.within ".labels-filter" do
click_link "feature"
end
end
......
......@@ -7,24 +7,24 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
include SharedMarkdown
step 'I should see "Release 0.4" in issues' do
page.should have_content "Release 0.4"
expect(page).to have_content "Release 0.4"
end
step 'I should not see "Release 0.3" in issues' do
page.should_not have_content "Release 0.3"
expect(page).not_to have_content "Release 0.3"
end
step 'I should not see "Tweet control" in issues' do
page.should_not have_content "Tweet control"
expect(page).not_to have_content "Tweet control"
end
step 'I should see that I am subscribed' do
find(".subscribe-button span").text.should == "Unsubscribe"
expect(find(".subscribe-button span").text).to eq "Unsubscribe"
end
step 'I should see that I am unsubscribed' do
sleep 0.2
find(".subscribe-button span").text.should == "Subscribe"
expect(find(".subscribe-button span").text).to eq "Subscribe"
end
step 'I click link "Closed"' do
......@@ -36,11 +36,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see "Release 0.3" in issues' do
page.should have_content "Release 0.3"
expect(page).to have_content "Release 0.3"
end
step 'I should not see "Release 0.4" in issues' do
page.should_not have_content "Release 0.4"
expect(page).not_to have_content "Release 0.4"
end
step 'I click link "All"' do
......@@ -52,7 +52,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see issue "Release 0.4"' do
page.should have_content "Release 0.4"
expect(page).to have_content "Release 0.4"
end
step 'I click link "New Issue"' do
......@@ -66,9 +66,9 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
step 'I see current user as the first user' do
expect(page).to have_selector('.user-result', visible: true, count: 4)
users = page.all('.user-name')
users[0].text.should == 'Any'
users[1].text.should == 'Unassigned'
users[2].text.should == current_user.name
expect(users[0].text).to eq 'Any'
expect(users[1].text).to eq 'Unassigned'
expect(users[2].text).to eq current_user.name
end
step 'I submit new issue "500 error on profile"' do
......@@ -87,16 +87,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see label \'bug\' with issue' do
within '.issue-show-labels' do
page.should have_content 'bug'
page.within '.issue-show-labels' do
expect(page).to have_content 'bug'
end
end
step 'I should see issue "500 error on profile"' do
issue = Issue.find_by(title: "500 error on profile")
page.should have_content issue.title
page.should have_content issue.author_name
page.should have_content issue.project.name
expect(page).to have_content issue.title
expect(page).to have_content issue.author_name
expect(page).to have_content issue.project.name
end
step 'I fill in issue search with "Re"' do
......@@ -139,7 +139,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
step 'I should see selected milestone with title "v3.0"' do
issues_milestone_selector = "#issue_milestone_id_chzn > a"
find(issues_milestone_selector).should have_content("v3.0")
expect(find(issues_milestone_selector)).to have_content("v3.0")
end
When 'I select first assignee from "Shop" project' do
......@@ -152,7 +152,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
issues_assignee_selector = "#issue_assignee_id_chzn > a"
assignee_name = project.users.first.name
find(issues_assignee_selector).should have_content(assignee_name)
expect(find(issues_assignee_selector)).to have_content(assignee_name)
end
step 'project "Shop" have "Release 0.4" open issue' do
......@@ -190,8 +190,8 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
step 'I see empty project details with ssh clone info' do
project = Project.find_by(name: 'Empty Project')
all(:css, '.git-empty .clone').each do |element|
element.text.should include(project.url_to_repo)
page.all(:css, '.git-empty .clone').each do |element|
expect(element.text).to include(project.url_to_repo)
end
end
......@@ -201,7 +201,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I leave a comment with code block' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
click_button "Add Comment"
sleep 0.05
......@@ -209,13 +209,13 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see an error alert section within the comment form' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
find(".error-alert")
end
end
step 'The code block should be unchanged' do
page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
expect(page).to have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
end
step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
......@@ -239,15 +239,15 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see \'Bugfix1\' in issues' do
page.should have_content 'Bugfix1'
expect(page).to have_content 'Bugfix1'
end
step 'I should see \'Feature1\' in issues' do
page.should have_content 'Feature1'
expect(page).to have_content 'Feature1'
end
step 'I should not see \'Bugfix1\' in issues' do
page.should_not have_content 'Bugfix1'
expect(page).not_to have_content 'Bugfix1'
end
step 'issue \'Release 0.4\' has label \'bug\'' do
......@@ -257,7 +257,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I click label \'bug\'' do
within ".issues-list" do
page.within ".issues-list" do
click_link 'bug'
end
end
......
......@@ -8,14 +8,14 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I remove label \'bug\'' do
within "#label_#{bug_label.id}" do
page.within "#label_#{bug_label.id}" do
click_link 'Remove'
end
end
step 'I delete all labels' do
within '.labels' do
all('.btn-remove').each do |remove|
page.within '.labels' do
page.all('.btn-remove').each do |remove|
remove.click
sleep 0.05
end
......@@ -23,8 +23,8 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I should see labels help message' do
within '.labels' do
page.should have_content 'Create first label or generate default set of '\
page.within '.labels' do
expect(page).to have_content 'Create first label or generate default set of '\
'labels'
end
end
......@@ -48,38 +48,38 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I should see label label exist error message' do
within '.label-form' do
page.should have_content 'Title has already been taken'
page.within '.label-form' do
expect(page).to have_content 'Title has already been taken'
end
end
step 'I should see label color error message' do
within '.label-form' do
page.should have_content 'Color is invalid'
page.within '.label-form' do
expect(page).to have_content 'Color is invalid'
end
end
step 'I should see label \'feature\'' do
within '.manage-labels-list' do
page.should have_content 'feature'
page.within '.manage-labels-list' do
expect(page).to have_content 'feature'
end
end
step 'I should see label \'bug\'' do
within '.manage-labels-list' do
page.should have_content 'bug'
page.within '.manage-labels-list' do
expect(page).to have_content 'bug'
end
end
step 'I should not see label \'bug\'' do
within '.manage-labels-list' do
page.should_not have_content 'bug'
page.within '.manage-labels-list' do
expect(page).not_to have_content 'bug'
end
end
step 'I should see label \'support\'' do
within '.manage-labels-list' do
page.should have_content 'support'
page.within '.manage-labels-list' do
expect(page).to have_content 'support'
end
end
......@@ -90,8 +90,8 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
end
step 'I should see label \'fix\'' do
within '.manage-labels-list' do
page.should have_content 'fix'
page.within '.manage-labels-list' do
expect(page).to have_content 'fix'
end
end
......
......@@ -6,9 +6,9 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
step 'I should see milestone "v2.2"' do
milestone = @project.milestones.find_by(title: "v2.2")
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Issues")
expect(page).to have_content(milestone.title[0..10])
expect(page).to have_content(milestone.expires_at)
expect(page).to have_content("Issues")
end
step 'I click link "v2.2"' do
......@@ -26,9 +26,9 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
step 'I should see milestone "v2.3"' do
milestone = @project.milestones.find_by(title: "v2.3")
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Issues")
expect(page).to have_content(milestone.title[0..10])
expect(page).to have_content(milestone.expires_at)
expect(page).to have_content("Issues")
end
step 'project "Shop" has milestone "v2.2"' do
......@@ -54,6 +54,6 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
end
step 'I should see 3 issues' do
page.should have_selector('#tab-issues li.issue-row', count: 4)
expect(page).to have_selector('#tab-issues li.issue-row', count: 4)
end
end
......@@ -24,44 +24,44 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see merge request "Wiki Feature"' do
within '.merge-request' do
page.should have_content "Wiki Feature"
page.within '.merge-request' do
expect(page).to have_content "Wiki Feature"
end
end
step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04")
merge_request.closed?.should be_true
page.should have_content "Rejected by"
expect(merge_request.closed?).to be_true
expect(page).to have_content "Rejected by"
end
step 'I should see merge request "Bug NS-04"' do
page.should have_content "Bug NS-04"
expect(page).to have_content "Bug NS-04"
end
step 'I should see "Bug NS-04" in merge requests' do
page.should have_content "Bug NS-04"
expect(page).to have_content "Bug NS-04"
end
step 'I should see "Feature NS-03" in merge requests' do
page.should have_content "Feature NS-03"
expect(page).to have_content "Feature NS-03"
end
step 'I should not see "Feature NS-03" in merge requests' do
page.should_not have_content "Feature NS-03"
expect(page).not_to have_content "Feature NS-03"
end
step 'I should not see "Bug NS-04" in merge requests' do
page.should_not have_content "Bug NS-04"
expect(page).not_to have_content "Bug NS-04"
end
step 'I should see that I am subscribed' do
find(".subscribe-button span").text.should == "Unsubscribe"
expect(find(".subscribe-button span").text).to eq "Unsubscribe"
end
step 'I should see that I am unsubscribed' do
find(".subscribe-button span").should have_content("Subscribe")
expect(find(".subscribe-button span")).to have_content("Subscribe")
end
step 'I click button "Unsubscribe"' do
......@@ -113,7 +113,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click on the Changes tab via Javascript' do
within '.merge-request-tabs' do
page.within '.merge-request-tabs' do
click_link 'Changes'
end
......@@ -121,11 +121,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see the proper Inline and Side-by-side links' do
buttons = all('#commit-diff-viewtype')
buttons = page.all('#commit-diff-viewtype')
expect(buttons.count).to eq(2)
buttons.each do |b|
expect(b['href']).should_not have_content('json')
expect(expect(b['href'])).not_to have_content('json')
end
end
......@@ -134,11 +134,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click on the commit in the merge request' do
within '.merge-request-tabs' do
page.within '.merge-request-tabs' do
click_link 'Commits'
end
within '.commits' do
page.within '.commits' do
click_link Commit.truncate_sha(sample_commit.id)
end
end
......@@ -164,24 +164,24 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see a discussion has started on diff' do
page.should have_content "#{current_user.name} started a discussion"
page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
expect(page).to have_content "#{current_user.name} started a discussion"
expect(page).to have_content sample_commit.line_code_path
expect(page).to have_content "Line is wrong"
end
step 'I should see a discussion has started on commit diff' do
page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
expect(page).to have_content "#{current_user.name} started a discussion on commit"
expect(page).to have_content sample_commit.line_code_path
expect(page).to have_content "Line is wrong"
end
step 'I should see a discussion has started on commit' do
page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "One comment to rule them all"
expect(page).to have_content "#{current_user.name} started a discussion on commit"
expect(page).to have_content "One comment to rule them all"
end
step 'merge request is mergeable' do
page.should have_button 'Accept Merge Request'
expect(page).to have_button 'Accept Merge Request'
end
step 'I modify merge commit message' do
......@@ -199,14 +199,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
merge!: true,
)
within '.mr-state-widget' do
page.within '.mr-state-widget' do
click_button "Accept Merge Request"
end
end
step 'I should see merged request' do
within '.issue-box' do
page.should have_content "Accepted"
page.within '.issue-box' do
expect(page).to have_content "Accepted"
end
end
......@@ -215,72 +215,72 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see reopened merge request "Bug NS-04"' do
within '.issue-box' do
page.should have_content "Open"
page.within '.issue-box' do
expect(page).to have_content "Open"
end
end
step 'I click link "Hide inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do
page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click
end
end
step 'I click link "Show inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do
page.within '.files [id^=diff]:nth-child(2)' do
find('.js-toggle-diff-comments').click
end
end
step 'I should not see a comment like "Line is wrong" in the second file' do
within '.files [id^=diff]:nth-child(2)' do
page.should_not have_visible_content "Line is wrong"
page.within '.files [id^=diff]:nth-child(2)' do
expect(page).not_to have_visible_content "Line is wrong"
end
end
step 'I should see a comment like "Line is wrong" in the second file' do
within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
page.should have_visible_content "Line is wrong"
page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
expect(page).to have_visible_content "Line is wrong"
end
end
step 'I should not see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2)' do
page.should_not have_visible_content "Line is wrong here"
page.within '.files [id^=diff]:nth-child(2)' do
expect(page).not_to have_visible_content "Line is wrong here"
end
end
step 'I should see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
page.should have_visible_content "Line is wrong here"
page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do
expect(page).to have_visible_content "Line is wrong here"
end
end
step 'I leave a comment like "Line is correct" on line 12 of the first file' do
init_diff_note_first_file
within(".js-discussion-note-form") do
page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is correct"
click_button "Add Comment"
end
within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do
page.should have_content "Line is correct"
page.within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do
expect(page).to have_content "Line is correct"
end
end
step 'I leave a comment like "Line is wrong" on line 39 of the second file' do
init_diff_note_second_file
within(".js-discussion-note-form") do
page.within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong on here"
click_button "Add Comment"
end
end
step 'I should still see a comment like "Line is correct" in the first file' do
within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
page.should have_visible_content "Line is correct"
page.within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do
expect(page).to have_visible_content "Line is correct"
end
end
......@@ -297,8 +297,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see comments on the side-by-side diff page' do
within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do
page.should have_visible_content "Line is correct"
page.within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do
expect(page).to have_visible_content "Line is correct"
end
end
......@@ -316,8 +316,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see new target branch changes' do
page.should have_content 'From fix into feature'
page.should have_content 'Target branch changed from master to feature'
expect(page).to have_content 'From fix into feature'
expect(page).to have_content 'Target branch changed from master to feature'
end
def merge_request
......@@ -329,12 +329,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
def leave_comment(message)
within(".js-discussion-note-form") do
page.within(".js-discussion-note-form") do
fill_in "note_note", with: message
click_button "Add Comment"
end
page.should have_content message
expect(page).to have_content message
end
def init_diff_note_first_file
......
......@@ -4,7 +4,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
include SharedProject
step 'page should have network graph' do
page.should have_selector ".network-graph"
expect(page).to have_selector ".network-graph"
end
When 'I visit project "Shop" network page' do
......@@ -16,16 +16,16 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step 'page should select "master" in select box' do
page.should have_selector '.select2-chosen', text: "master"
expect(page).to have_selector '.select2-chosen', text: "master"
end
step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0"
expect(page).to have_selector '.select2-chosen', text: "v1.0.0"
end
step 'page should have "master" on graph' do
within '.network-graph' do
page.should have_content 'master'
page.within '.network-graph' do
expect(page).to have_content 'master'
end
end
......@@ -45,33 +45,33 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step 'page should have content not containing "v1.0.0"' do
within '.network-graph' do
page.should have_content 'Change some files'
page.within '.network-graph' do
expect(page).to have_content 'Change some files'
end
end
step 'page should not have content not containing "v1.0.0"' do
within '.network-graph' do
page.should_not have_content 'Change some files'
page.within '.network-graph' do
expect(page).not_to have_content 'Change some files'
end
end
step 'page should select "feature" in select box' do
page.should have_selector '.select2-chosen', text: "feature"
expect(page).to have_selector '.select2-chosen', text: "feature"
end
step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0"
expect(page).to have_selector '.select2-chosen', text: "v1.0.0"
end
step 'page should have "feature" on graph' do
within '.network-graph' do
page.should have_content 'feature'
page.within '.network-graph' do
expect(page).to have_content 'feature'
end
end
When 'I looking for a commit by SHA of "v1.0.0"' do
within ".network-form" do
page.within ".network-form" do
fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
find('button').click
end
......@@ -79,13 +79,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step 'page should have "v1.0.0" on graph' do
within '.network-graph' do
page.should have_content 'v1.0.0'
page.within '.network-graph' do
expect(page).to have_content 'v1.0.0'
end
end
When 'I look for a commit by ";"' do
within ".network-form" do
page.within ".network-form" do
fill_in 'extended_sha1', with: ';'
find('button').click
end
......
......@@ -13,7 +13,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see project with new settings' do
find_field('project_name').value.should == 'NewName'
expect(find_field('project_name').value).to eq 'NewName'
end
step 'change project path settings' do
......@@ -22,7 +22,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see project with new path settings' do
project.path.should == 'new-path'
expect(project.path).to eq 'new-path'
end
step 'I change the project avatar' do
......@@ -35,13 +35,13 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see new project avatar' do
@project.avatar.should be_instance_of AvatarUploader
expect(@project.avatar).to be_instance_of AvatarUploader
url = @project.avatar.url
url.should == "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png"
expect(url).to eq "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png"
end
step 'I should see the "Remove avatar" button' do
page.should have_link('Remove avatar')
expect(page).to have_link('Remove avatar')
end
step 'I have an project avatar' do
......@@ -59,16 +59,16 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see the default project avatar' do
@project.avatar?.should be_false
expect(@project.avatar?).to be_false
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link('Remove avatar')
expect(page).not_to have_link('Remove avatar')
end
step 'I should see project "Shop" version' do
within '.project-side' do
page.should have_content '6.7.0.pre'
page.within '.project-side' do
expect(page).to have_content '6.7.0.pre'
end
end
......@@ -78,7 +78,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see project default branch changed' do
find(:css, 'select#project_default_branch').value.should == 'fix'
expect(find(:css, 'select#project_default_branch').value).to eq 'fix'
end
step 'I select project "Forum" README tab' do
......@@ -86,13 +86,13 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see project "Forum" README' do
page.should have_link 'README.md'
page.should have_content 'Sample repo for testing gitlab features'
expect(page).to have_link 'README.md'
expect(page).to have_content 'Sample repo for testing gitlab features'
end
step 'I should see project "Shop" README' do
page.should have_link 'README.md'
page.should have_content 'testme'
expect(page).to have_link 'README.md'
expect(page).to have_content 'testme'
end
step 'I add project tags' do
......@@ -104,14 +104,14 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should not see "New Issue" button' do
page.should_not have_link 'New Issue'
expect(page).not_to have_link 'New Issue'
end
step 'I should not see "New Merge Request" button' do
page.should_not have_link 'New Merge Request'
expect(page).not_to have_link 'New Merge Request'
end
step 'I should not see "Snippets" button' do
page.should_not have_link 'Snippets'
expect(page).not_to have_link 'Snippets'
end
end
......@@ -18,8 +18,8 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should see project "Community" home page' do
Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com")
within '.navbar-gitlab .title' do
page.should have_content 'Community'
page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Community'
end
end
......@@ -48,8 +48,8 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should be redirected to "Community" page' do
project = Project.find_by(name: 'Community')
current_path.should == "/#{project.path_with_namespace}"
status_code.should == 200
expect(current_path).to eq "/#{project.path_with_namespace}"
expect(status_code).to eq 200
end
step 'I get redirected to signin page where I sign in' do
......@@ -63,7 +63,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should be redirected to "Enterprise" page' do
project = Project.find_by(name: 'Enterprise')
current_path.should == "/#{project.path_with_namespace}"
status_code.should == 200
expect(current_path).to eq "/#{project.path_with_namespace}"
expect(status_code).to eq 200
end
end
......@@ -8,16 +8,16 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see list of available services' do
page.should have_content 'Project services'
page.should have_content 'Campfire'
page.should have_content 'HipChat'
page.should have_content 'GitLab CI'
page.should have_content 'Assembla'
page.should have_content 'Pushover'
page.should have_content 'Atlassian Bamboo'
page.should have_content 'JetBrains TeamCity'
page.should have_content 'Asana'
page.should have_content 'Irker (IRC gateway)'
expect(page).to have_content 'Project services'
expect(page).to have_content 'Campfire'
expect(page).to have_content 'HipChat'
expect(page).to have_content 'GitLab CI'
expect(page).to have_content 'Assembla'
expect(page).to have_content 'Pushover'
expect(page).to have_content 'Atlassian Bamboo'
expect(page).to have_content 'JetBrains TeamCity'
expect(page).to have_content 'Asana'
expect(page).to have_content 'Irker (IRC gateway)'
end
step 'I click gitlab-ci service link' do
......@@ -32,7 +32,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see service settings saved' do
find_field('Project url').value.should == 'http://ci.gitlab.org/projects/3'
expect(find_field('Project url').value).to eq 'http://ci.gitlab.org/projects/3'
end
step 'I click hipchat service link' do
......@@ -47,7 +47,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see hipchat service settings saved' do
find_field('Room').value.should == 'gitlab'
expect(find_field('Room').value).to eq 'gitlab'
end
step 'I fill hipchat settings with custom server' do
......@@ -59,7 +59,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see hipchat service settings with custom server saved' do
find_field('Server').value.should == 'https://chat.example.com'
expect(find_field('Server').value).to eq 'https://chat.example.com'
end
step 'I click pivotaltracker service link' do
......@@ -73,7 +73,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see pivotaltracker service settings saved' do
find_field('Token').value.should == 'verySecret'
expect(find_field('Token').value).to eq 'verySecret'
end
step 'I click Flowdock service link' do
......@@ -87,7 +87,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Flowdock service settings saved' do
find_field('Token').value.should == 'verySecret'
expect(find_field('Token').value).to eq 'verySecret'
end
step 'I click Assembla service link' do
......@@ -101,7 +101,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Assembla service settings saved' do
find_field('Token').value.should == 'verySecret'
expect(find_field('Token').value).to eq 'verySecret'
end
step 'I click Asana service link' do
......@@ -116,8 +116,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Asana service settings saved' do
find_field('Api key').value.should == 'verySecret'
find_field('Restrict to branch').value.should == 'master'
expect(find_field('Api key').value).to eq 'verySecret'
expect(find_field('Restrict to branch').value).to eq 'master'
end
step 'I click email on push service link' do
......@@ -130,7 +130,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see email on push service settings saved' do
find_field('Recipients').value.should == 'qa@company.name'
expect(find_field('Recipients').value).to eq 'qa@company.name'
end
step 'I click Irker service link' do
......@@ -145,8 +145,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Irker service settings saved' do
find_field('Recipients').value.should == 'irc://chat.freenode.net/#commits'
find_field('Colorize messages').value.should == '1'
expect(find_field('Recipients').value).to eq 'irc://chat.freenode.net/#commits'
expect(find_field('Colorize messages').value).to eq '1'
end
step 'I click Slack service link' do
......@@ -160,7 +160,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Slack service settings saved' do
find_field('Webhook').value.should == 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
expect(find_field('Webhook').value).to eq 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
end
step 'I click Pushover service link' do
......@@ -178,11 +178,11 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Pushover service settings saved' do
find_field('Api key').value.should == 'verySecret'
find_field('User key').value.should == 'verySecret'
find_field('Device').value.should == 'myDevice'
find_field('Priority').find('option[selected]').value.should == '1'
find_field('Sound').find('option[selected]').value.should == 'bike'
expect(find_field('Api key').value).to eq 'verySecret'
expect(find_field('User key').value).to eq 'verySecret'
expect(find_field('Device').value).to eq 'myDevice'
expect(find_field('Priority').find('option[selected]').value).to eq '1'
expect(find_field('Sound').find('option[selected]').value).to eq 'bike'
end
step 'I click Atlassian Bamboo CI service link' do
......@@ -199,9 +199,9 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see Atlassian Bamboo CI service settings saved' do
find_field('Bamboo url').value.should == 'http://bamboo.example.com'
find_field('Build key').value.should == 'KEY'
find_field('Username').value.should == 'user'
expect(find_field('Bamboo url').value).to eq 'http://bamboo.example.com'
expect(find_field('Build key').value).to eq 'KEY'
expect(find_field('Username').value).to eq 'user'
end
step 'I click JetBrains TeamCity CI service link' do
......@@ -218,8 +218,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end
step 'I should see JetBrains TeamCity CI service settings saved' do
find_field('Teamcity url').value.should == 'http://teamcity.example.com'
find_field('Build type').value.should == 'GitlabTest_Build'
find_field('Username').value.should == 'user'
expect(find_field('Teamcity url').value).to eq 'http://teamcity.example.com'
expect(find_field('Build type').value).to eq 'GitlabTest_Build'
expect(find_field('Username').value).to eq 'user'
end
end
......@@ -30,19 +30,19 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end
step 'I should see "Snippet one" in snippets' do
page.should have_content "Snippet one"
expect(page).to have_content "Snippet one"
end
step 'I should not see "Snippet two" in snippets' do
page.should_not have_content "Snippet two"
expect(page).not_to have_content "Snippet two"
end
step 'I should not see "Snippet one" in snippets' do
page.should_not have_content "Snippet one"
expect(page).not_to have_content "Snippet one"
end
step 'I click link "Edit"' do
within ".file-title" do
page.within ".file-title" do
click_link "Edit"
end
end
......@@ -54,15 +54,15 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
step 'I submit new snippet "Snippet three"' do
fill_in "project_snippet_title", :with => "Snippet three"
fill_in "project_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do
page.within('.file-editor') do
find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three'
end
click_button "Create snippet"
end
step 'I should see snippet "Snippet three"' do
page.should have_content "Snippet three"
page.should have_content "Content of snippet three"
expect(page).to have_content "Snippet three"
expect(page).to have_content "Content of snippet three"
end
step 'I submit new title "Snippet new title"' do
......@@ -71,18 +71,18 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end
step 'I should see "Snippet new title"' do
page.should have_content "Snippet new title"
expect(page).to have_content "Snippet new title"
end
step 'I leave a comment like "Good snippet!"' do
within('.js-main-target-form') do
page.within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!"
click_button "Add Comment"
end
end
step 'I should see comment "Good snippet!"' do
page.should have_content "Good snippet!"
expect(page).to have_content "Good snippet!"
end
step 'I visit snippet page "Snippet one"' do
......
......@@ -5,23 +5,23 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
include RepoHelpers
step 'I should see files from repository' do
page.should have_content "VERSION"
page.should have_content ".gitignore"
page.should have_content "LICENSE"
expect(page).to have_content "VERSION"
expect(page).to have_content ".gitignore"
expect(page).to have_content "LICENSE"
end
step 'I should see files from repository for "6d39438"' do
current_path.should == namespace_project_tree_path(@project.namespace, @project, "6d39438")
page.should have_content ".gitignore"
page.should have_content "LICENSE"
expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "6d39438")
expect(page).to have_content ".gitignore"
expect(page).to have_content "LICENSE"
end
step 'I see the ".gitignore"' do
page.should have_content '.gitignore'
expect(page).to have_content '.gitignore'
end
step 'I don\'t see the ".gitignore"' do
page.should_not have_content '.gitignore'
expect(page).not_to have_content '.gitignore'
end
step 'I click on ".gitignore" file in repo' do
......@@ -29,11 +29,11 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I should see its content' do
page.should have_content old_gitignore_content
expect(page).to have_content old_gitignore_content
end
step 'I should see its new content' do
page.should have_content new_gitignore_content
expect(page).to have_content new_gitignore_content
end
step 'I click link "Raw"' do
......@@ -41,7 +41,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I should see raw file content' do
source.should == sample_blob.data
expect(source).to eq sample_blob.data
end
step 'I click button "Edit"' do
......@@ -49,16 +49,16 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I cannot see the edit button' do
page.should_not have_link 'edit'
expect(page).not_to have_link 'edit'
end
step 'The edit button is disabled' do
page.should have_css '.disabled', text: 'Edit'
expect(page).to have_css '.disabled', text: 'Edit'
end
step 'I can edit code' do
set_new_content
evaluate_script('blob.editor.getValue()').should == new_gitignore_content
expect(evaluate_script('blob.editor.getValue()')).to eq new_gitignore_content
end
step 'I edit code' do
......@@ -98,7 +98,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I see diff' do
page.should have_css '.line_holder.new'
expect(page).to have_css '.line_holder.new'
end
step 'I click on "new file" link in repo' do
......@@ -106,8 +106,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I can see new file page' do
page.should have_content "New file"
page.should have_content "Commit message"
expect(page).to have_content "New file"
expect(page).to have_content "Commit message"
end
step 'I click on files directory' do
......@@ -119,25 +119,25 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I see Browse dir link' do
page.should have_link 'Browse Dir »'
page.should_not have_link 'Browse Code »'
expect(page).to have_link 'Browse Dir »'
expect(page).not_to have_link 'Browse Code »'
end
step 'I click on readme file' do
within '.tree-table' do
page.within '.tree-table' do
click_link 'README.md'
end
end
step 'I see Browse file link' do
page.should have_link 'Browse File »'
page.should_not have_link 'Browse Code »'
expect(page).to have_link 'Browse File »'
expect(page).not_to have_link 'Browse Code »'
end
step 'I see Browse code link' do
page.should have_link 'Browse Code »'
page.should_not have_link 'Browse File »'
page.should_not have_link 'Browse Dir »'
expect(page).to have_link 'Browse Code »'
expect(page).not_to have_link 'Browse File »'
expect(page).not_to have_link 'Browse Dir »'
end
step 'I click on Permalink' do
......@@ -145,7 +145,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step 'I am redirected to the files URL' do
current_path.should == namespace_project_tree_path(@project.namespace, @project, 'master')
expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, 'master')
end
step 'I am redirected to the ".gitignore"' do
......
......@@ -12,8 +12,8 @@ class Spinach::Features::ProjectSourceGitBlame < Spinach::FeatureSteps
end
step 'I should see git file blame' do
page.should have_content "*.rb"
page.should have_content "Dmitriy Zaporozhets"
page.should have_content "Initial commit"
expect(page).to have_content "*.rb"
expect(page).to have_content "Dmitriy Zaporozhets"
expect(page).to have_content "Initial commit"
end
end
......@@ -23,19 +23,19 @@ class Spinach::Features::ProjectSourceMultiselectBlob < Spinach::FeatureSteps
pluralization = range.kind_of?(Array) ? "s" : ""
step "I should see \"#{fragment}\" as URI fragment" do
URI.parse(current_url).fragment.should == fragment
expect(URI.parse(current_url).fragment).to eq fragment
end
step "I should see line#{pluralization} #{fragment[1..-1]} highlighted" do
ids = Array(range).map { |n| "LC#{n}" }
extra = false
highlighted = all("#tree-content-holder .highlight .line.hll")
highlighted = page.all("#tree-content-holder .highlight .line.hll")
highlighted.each do |element|
extra ||= ids.delete(element[:id]).nil?
end
extra.should be_false and ids.should be_empty
expect(extra).to be_false and ids.should be_empty
end
end
end
......
......@@ -9,11 +9,11 @@ class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps
end
step 'I should see files from repository containing "coffee"' do
page.should have_content 'coffee'
page.should have_content 'CONTRIBUTING.md'
expect(page).to have_content 'coffee'
expect(page).to have_content 'CONTRIBUTING.md'
end
step 'I should see empty result' do
page.should have_content "We couldn't find any"
expect(page).to have_content "We couldn't find any"
end
end
......@@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
include SharedUser
step "The project has no stars" do
page.should_not have_content '.star-buttons'
expect(page).not_to have_content '.star-buttons'
end
step "The project has 0 stars" do
......@@ -26,7 +26,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
end
step 'I redirected to sign in page' do
current_path.should == new_user_session_path
expect(current_path).to eq new_user_session_path
end
protected
......
......@@ -5,14 +5,14 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
include Select2Helper
step 'I should be able to see myself in team' do
page.should have_content(@user.name)
page.should have_content(@user.username)
expect(page).to have_content(@user.name)
expect(page).to have_content(@user.username)
end
step 'I should see "Dmitriy" in team list' do
user = User.find_by(name: "Dmitriy")
page.should have_content(user.name)
page.should have_content(user.username)
expect(page).to have_content(user.name)
expect(page).to have_content(user.username)
end
step 'I click link "Add members"' do
......@@ -22,7 +22,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike")
within ".users-project-form" do
page.within ".users-project-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -30,13 +30,13 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
step 'I should see "Mike" in team list as "Reporter"' do
within ".access-reporter" do
page.should have_content('Mike')
page.within ".access-reporter" do
expect(page).to have_content('Mike')
end
end
step 'I select "sjobs@apple.com" as "Reporter"' do
within ".users-project-form" do
page.within ".users-project-form" do
select2("sjobs@apple.com", from: "#user_ids", multiple: true)
select "Reporter", from: "access_level"
end
......@@ -44,16 +44,16 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
within ".access-reporter" do
page.should have_content('sjobs@apple.com')
page.should have_content('invited')
page.should have_content('Reporter')
page.within ".access-reporter" do
expect(page).to have_content('sjobs@apple.com')
expect(page).to have_content('invited')
expect(page).to have_content('Reporter')
end
end
step 'I should see "Dmitriy" in team list as "Developer"' do
within ".access-developer" do
page.should have_content('Dmitriy')
page.within ".access-developer" do
expect(page).to have_content('Dmitriy')
end
end
......@@ -61,7 +61,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy')
project_member = project.project_members.find_by(user_id: user.id)
within "#project_member_#{project_member.id}" do
page.within "#project_member_#{project_member.id}" do
click_button "Edit access level"
select "Reporter", from: "project_member_access_level"
click_button "Save"
......@@ -69,8 +69,8 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
step 'I should see "Dmitriy" in team list as "Reporter"' do
within ".access-reporter" do
page.should have_content('Dmitriy')
page.within ".access-reporter" do
expect(page).to have_content('Dmitriy')
end
end
......@@ -80,8 +80,8 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I should not see "Dmitriy" in team list' do
user = User.find_by(name: "Dmitriy")
page.should_not have_content(user.name)
page.should_not have_content(user.username)
expect(page).not_to have_content(user.name)
expect(page).not_to have_content(user.username)
end
step 'gitlab user "Mike"' do
......@@ -123,7 +123,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
project = Project.find_by(name: "Shop")
user = User.find_by(name: 'Dmitriy')
project_member = project.project_members.find_by(user_id: user.id)
within "#project_member_#{project_member.id}" do
page.within "#project_member_#{project_member.id}" do
click_link('Remove user from team')
end
end
......
......@@ -6,13 +6,13 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include WikiHelper
step 'I click on the Cancel button' do
within(:css, ".form-actions") do
page.within(:css, ".form-actions") do
click_on "Cancel"
end
end
step 'I should be redirected back to the Edit Home Wiki page' do
current_path.should == namespace_project_wiki_path(project.namespace, project, :home)
expect(current_path).to eq namespace_project_wiki_path(project.namespace, project, :home)
end
step 'I create the Wiki Home page' do
......@@ -21,11 +21,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see the newly created wiki page' do
page.should have_content "Home"
page.should have_content "link test"
expect(page).to have_content "Home"
expect(page).to have_content "link test"
click_link "link test"
page.should have_content "Editing"
expect(page).to have_content "Editing"
end
step 'I have an existing Wiki page' do
......@@ -47,11 +47,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see the updated content' do
page.should have_content "Updated Wiki Content"
expect(page).to have_content "Updated Wiki Content"
end
step 'I should be redirected back to that Wiki page' do
current_path.should == namespace_project_wiki_path(project.namespace, project, @page)
expect(current_path).to eq namespace_project_wiki_path(project.namespace, project, @page)
end
step 'That page has two revisions' do
......@@ -63,9 +63,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see both revisions' do
page.should have_content current_user.name
page.should have_content "first commit"
page.should have_content "second commit"
expect(page).to have_content current_user.name
expect(page).to have_content "first commit"
expect(page).to have_content "second commit"
end
step 'I click on the "Delete this page" button' do
......@@ -73,7 +73,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'The page should be deleted' do
page.should have_content "Page was successfully deleted"
expect(page).to have_content "Page was successfully deleted"
end
step 'I click on the "Pages" button' do
......@@ -81,8 +81,8 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see the existing page in the pages list' do
page.should have_content current_user.name
page.should have_content @page.title
expect(page).to have_content current_user.name
expect(page).to have_content @page.title
end
step 'I have an existing Wiki page with images linked on page' do
......@@ -98,30 +98,30 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
file = Gollum::File.new(wiki.wiki)
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")
page.should have_link('image', href: "image.jpg")
expect(page).to have_link('image', href: "image.jpg")
click_on "image"
end
step 'I should see the image from wiki repo' do
current_path.should match('wikis/image.jpg')
page.should_not have_xpath('/html') # Page should render the image which means there is no html involved
expect(current_path).to match('wikis/image.jpg')
expect(page).not_to have_xpath('/html') # Page should render the image which means there is no html involved
Gollum::Wiki.any_instance.unstub(:file)
Gollum::File.any_instance.unstub(:mime_type)
end
step 'Image should be shown on the page' do
page.should have_xpath("//img[@src=\"image.jpg\"]")
expect(page).to have_xpath("//img[@src=\"image.jpg\"]")
end
step 'I click on image link' do
page.should have_link('image', href: "image.jpg")
expect(page).to have_link('image', href: "image.jpg")
click_on "image"
end
step 'I should see the new wiki page form' do
current_path.should match('wikis/image.jpg')
page.should have_content('New Wiki Page')
page.should have_content('Editing - image.jpg')
expect(current_path).to match('wikis/image.jpg')
expect(page).to have_content('New Wiki Page')
expect(page).to have_content('Editing - image.jpg')
end
step 'I create a New page with paths' do
......@@ -130,7 +130,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
click_on 'Build'
fill_in "wiki_content", with: 'wiki content'
click_on "Create page"
current_path.should include 'one/two/three'
expect(current_path).to include 'one/two/three'
end
step 'I create a New page with an invalid name' do
......@@ -144,7 +144,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see non-escaped link in the pages list' do
page.should have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three']")
expect(page).to have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three']")
end
step 'I edit the Wiki page with a path' do
......@@ -153,11 +153,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see a non-escaped path' do
current_path.should include 'one/two/three'
expect(current_path).to include 'one/two/three'
end
step 'I should see the Editing page' do
page.should have_content('Editing')
expect(page).to have_content('Editing')
end
step 'I view the page history of a Wiki page that has a path' do
......@@ -166,7 +166,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step 'I should see the page history' do
page.should have_content('History for')
expect(page).to have_content('History for')
end
step 'I search for Wiki content' do
......
......@@ -24,35 +24,35 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end
step 'I click "Issues" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Issues'
end
end
step 'I click project "Shop" link' do
within '.project-filter' do
page.within '.project-filter' do
click_link project.name_with_namespace
end
end
step 'I click "Merge requests" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Merge requests'
end
end
step 'I click "Wiki" link' do
within '.search-filter' do
page.within '.search-filter' do
click_link 'Wiki'
end
end
step 'I should see "Shop" project link' do
page.should have_link "Shop"
expect(page).to have_link "Shop"
end
step 'I should see code results for project "Shop"' do
page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
expect(page).to have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
end
step 'I search for "Contibuting"' do
......@@ -71,15 +71,15 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end
step 'I should see "Foo" link in the search results' do
find(:css, '.search-results').should have_link 'Foo'
expect(find(:css, '.search-results')).to have_link 'Foo'
end
step 'I should not see "Bar" link in the search results' do
find(:css, '.search-results').should_not have_link 'Bar'
expect(find(:css, '.search-results')).not_to have_link 'Bar'
end
step 'I should see "test_wiki" link in the search results' do
find(:css, '.search-results').should have_link 'test_wiki.md'
expect(find(:css, '.search-results')).to have_link 'test_wiki.md'
end
step 'project has Wiki content' do
......
......@@ -2,27 +2,27 @@ module SharedActiveTab
include Spinach::DSL
def ensure_active_main_tab(content)
find('.nav-sidebar > li.active').should have_content(content)
expect(find('.nav-sidebar > li.active')).to have_content(content)
end
def ensure_active_sub_tab(content)
find('div.content ul.nav-tabs li.active').should have_content(content)
expect(find('div.content ul.nav-tabs li.active')).to have_content(content)
end
def ensure_active_sub_nav(content)
find('.sidebar-subnav > li.active').should have_content(content)
expect(find('.sidebar-subnav > li.active')).to have_content(content)
end
step 'no other main tabs should be active' do
page.should have_selector('.nav-sidebar > li.active', count: 1)
expect(page).to have_selector('.nav-sidebar > li.active', count: 1)
end
step 'no other sub tabs should be active' do
page.should have_selector('div.content ul.nav-tabs li.active', count: 1)
expect(page).to have_selector('div.content ul.nav-tabs li.active', count: 1)
end
step 'no other sub navs should be active' do
page.should have_selector('.sidebar-subnav > li.active', count: 1)
expect(page).to have_selector('.sidebar-subnav > li.active', count: 1)
end
step 'the active main tab should be Home' do
......
......@@ -21,7 +21,7 @@ module SharedAuthentication
end
step 'I should be redirected to sign in page' do
current_path.should == new_user_session_path
expect(current_path).to eq new_user_session_path
end
step "I logout" do
......
......@@ -3,7 +3,7 @@ module SharedDiffNote
include RepoHelpers
step 'I cancel the diff comment' do
within(diff_file_selector) do
page.within(diff_file_selector) do
find(".js-close-discussion-note-form").click
end
end
......@@ -14,14 +14,14 @@ module SharedDiffNote
end
step 'I haven\'t written any diff comment text' do
within(diff_file_selector) do
page.within(diff_file_selector) do
fill_in "note[note]", with: ""
end
end
step 'I leave a diff comment like "Typo, please fix"' do
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix"
find(".js-comment-button").trigger("click")
sleep 0.05
......@@ -30,7 +30,7 @@ module SharedDiffNote
step 'I preview a diff comment text like "Should fix it :smile:"' do
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:"
find('.js-md-preview-button').click
end
......@@ -39,7 +39,7 @@ module SharedDiffNote
step 'I preview another diff comment text like "DRY this up"' do
click_diff_line(sample_commit.del_line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
page.within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up"
find('.js-md-preview-button').click
end
......@@ -54,103 +54,103 @@ module SharedDiffNote
end
step 'I write a diff comment like ":-1: I don\'t like this"' do
within(diff_file_selector) do
page.within(diff_file_selector) do
fill_in "note[note]", with: ":-1: I don\'t like this"
end
end
step 'I submit the diff comment' do
within(diff_file_selector) do
page.within(diff_file_selector) do
click_button("Add Comment")
end
end
step 'I should not see the diff comment form' do
within(diff_file_selector) do
page.should_not have_css("form.new_note")
page.within(diff_file_selector) do
expect(page).not_to have_css("form.new_note")
end
end
step 'The diff comment preview tab should say there is nothing to do' do
within(diff_file_selector) do
page.within(diff_file_selector) do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the diff comment text field' do
within(diff_file_selector) do
page.within(diff_file_selector) do
expect(find('.js-note-text')).not_to be_visible
end
end
step 'I should only see one diff form' do
within(diff_file_selector) do
page.should have_css("form.new_note", count: 1)
page.within(diff_file_selector) do
expect(page).to have_css("form.new_note", count: 1)
end
end
step 'I should see a diff comment form with ":-1: I don\'t like this"' do
within(diff_file_selector) do
page.should have_field("note[note]", with: ":-1: I don\'t like this")
page.within(diff_file_selector) do
expect(page).to have_field("note[note]", with: ":-1: I don\'t like this")
end
end
step 'I should see a diff comment saying "Typo, please fix"' do
within("#{diff_file_selector} .note") do
page.should have_content("Typo, please fix")
page.within("#{diff_file_selector} .note") do
expect(page).to have_content("Typo, please fix")
end
end
step 'I should see a discussion reply button' do
within(diff_file_selector) do
page.should have_button('Reply')
page.within(diff_file_selector) do
expect(page).to have_button('Reply')
end
end
step 'I should see a temporary diff comment form' do
within(diff_file_selector) do
page.should have_css(".js-temp-notes-holder form.new_note")
page.within(diff_file_selector) do
expect(page).to have_css(".js-temp-notes-holder form.new_note")
end
end
step 'I should see add a diff comment button' do
page.should have_css('.js-add-diff-note-button', visible: true)
expect(page).to have_css('.js-add-diff-note-button', visible: true)
end
step 'I should see an empty diff comment form' do
within(diff_file_selector) do
page.should have_field("note[note]", with: "")
page.within(diff_file_selector) do
expect(page).to have_field("note[note]", with: "")
end
end
step 'I should see the cancel comment button' do
within("#{diff_file_selector} form") do
page.should have_css(".js-close-discussion-note-form", text: "Cancel")
page.within("#{diff_file_selector} form") do
expect(page).to have_css(".js-close-discussion-note-form", text: "Cancel")
end
end
step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do
page.within("#{diff_file_selector} form") do
expect(page).to have_css('.js-md-preview', visible: true)
end
end
step 'I should see the diff comment write tab' do
within(diff_file_selector) do
page.within(diff_file_selector) do
expect(page).to have_css('.js-md-write-button', visible: true)
end
end
step 'The diff comment preview tab should display rendered Markdown' do
within(diff_file_selector) do
page.within(diff_file_selector) do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
step 'I should see two separate previews' do
within(diff_file_selector) do
page.within(diff_file_selector) do
expect(page).to have_css('.js-md-preview', visible: true, count: 2)
expect(page).to have_content('Should fix it')
expect(page).to have_content('DRY this up')
......
......@@ -22,11 +22,11 @@ module SharedGroup
end
step 'I should see group "TestGroup"' do
page.should have_content "TestGroup"
expect(page).to have_content "TestGroup"
end
step 'I should not see group "TestGroup"' do
page.should_not have_content "TestGroup"
expect(page).not_to have_content "TestGroup"
end
protected
......
......@@ -3,11 +3,11 @@ module SharedMarkdown
def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki")
node = find("#{parent} h#{level} a##{id}")
node[:href].should == "##{id}"
expect(node[:href]).to eq "##{id}"
# Work around a weird Capybara behavior where calling `parent` on a node
# returns the whole document, not the node's actual parent element
find(:xpath, "#{node.path}/..").text.should == text
expect(find(:xpath, "#{node.path}/..").text).to eq text
end
step 'Header "Description header" should have correct id and link' do
......@@ -19,7 +19,7 @@ module SharedMarkdown
end
step 'The Markdown preview tab should say there is nothing to do' do
within('.gfm-form') do
page.within('.gfm-form') do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
......@@ -38,7 +38,7 @@ module SharedMarkdown
end
step 'The Markdown preview tab should display rendered Markdown' do
within('.gfm-form') do
page.within('.gfm-form') do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
......@@ -49,7 +49,7 @@ module SharedMarkdown
end
step 'I preview a description text like "Bug fixed :smile:"' do
within('.gfm-form') do
page.within('.gfm-form') do
fill_in 'Description', with: 'Bug fixed :smile:'
find('.js-md-preview-button').click
end
......
......@@ -7,13 +7,13 @@ module SharedNote
end
step 'I haven\'t written any comment text' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in "note[note]", with: ""
end
end
step 'I leave a comment like "XML attached"' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached"
click_button "Add Comment"
sleep 0.05
......@@ -21,94 +21,94 @@ module SharedNote
end
step 'I preview a comment text like "Bug fixed :smile:"' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:"
find('.js-md-preview-button').click
end
end
step 'I submit the comment' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
click_button "Add Comment"
end
end
step 'I write a comment like ":+1: Nice"' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in 'note[note]', with: ':+1: Nice'
end
end
step 'I should not see a comment saying "XML attached"' do
page.should_not have_css(".note")
expect(page).not_to have_css(".note")
end
step 'I should not see the cancel comment button' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
should_not have_link("Cancel")
end
end
step 'I should not see the comment preview' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
expect(find('.js-md-preview')).not_to be_visible
end
end
step 'The comment preview tab should say there is nothing to do' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the comment text field' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
expect(find('.js-note-text')).not_to be_visible
end
end
step 'I should see a comment saying "XML attached"' do
within(".note") do
page.should have_content("XML attached")
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
step 'I should see an empty comment text field' do
within(".js-main-target-form") do
page.should have_field("note[note]", with: "")
page.within(".js-main-target-form") do
expect(page).to have_field("note[note]", with: "")
end
end
step 'I should see the comment write tab' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-write-button', visible: true)
end
end
step 'The comment preview tab should be display rendered Markdown' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
end
end
step 'I should see the comment preview' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-preview', visible: true)
end
end
step 'I should see comment "XML attached"' do
within(".note") do
page.should have_content("XML attached")
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
# Markdown
step 'I leave a comment with a header containing "Comment with a header"' do
within(".js-main-target-form") do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "# Comment with a header"
click_button "Add Comment"
sleep 0.05
......@@ -116,9 +116,9 @@ module SharedNote
end
step 'The comment with the header should not have an ID' do
within(".note-body > .note-text") do
page.should have_content("Comment with a header")
page.should_not have_css("#comment-with-a-header")
page.within(".note-body > .note-text") do
expect(page).to have_content("Comment with a header")
expect(page).not_to have_css("#comment-with-a-header")
end
end
......@@ -126,7 +126,7 @@ module SharedNote
find(".note").hover
find('.js-note-edit').click
within(".current-note-edit-form") do
page.within(".current-note-edit-form") do
fill_in 'note[note]', with: '+1 Awesome!'
click_button 'Save Comment'
sleep 0.05
......@@ -134,8 +134,8 @@ module SharedNote
end
step 'I should see +1 in the description' do
within(".note") do
page.should have_content("+1 Awesome!")
page.within(".note") do
expect(page).to have_content("+1 Awesome!")
end
end
end
......@@ -92,7 +92,7 @@ module SharedPaths
end
step 'I should be redirected to the dashboard groups page' do
current_path.should == dashboard_groups_path
expect(current_path).to eq dashboard_groups_path
end
step 'I visit dashboard starred projects page' do
......@@ -292,11 +292,11 @@ module SharedPaths
end
step 'I am on the new file page' do
current_path.should eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
expect(current_path).to eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
end
step 'I am on the ".gitignore" edit file page' do
current_path.should eq(namespace_project_edit_blob_path(
expect(current_path).to eq(namespace_project_edit_blob_path(
@project.namespace, @project, File.join(root_ref, '.gitignore')))
end
......@@ -459,6 +459,6 @@ module SharedPaths
# ----------------------------------------
step 'page status code should be 404' do
status_code.should == 404
expect(status_code).to eq 404
end
end
......@@ -79,13 +79,13 @@ module SharedProject
step 'I should see project "Shop" activity feed' do
project = Project.find_by(name: "Shop")
page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}"
expect(page).to have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}"
end
step 'I should see project settings' do
current_path.should == edit_namespace_project_path(@project.namespace, @project)
page.should have_content("Project name")
page.should have_content("Features:")
expect(current_path).to eq edit_namespace_project_path(@project.namespace, @project)
expect(page).to have_content("Project name")
expect(page).to have_content("Features:")
end
def current_project
......@@ -101,11 +101,11 @@ module SharedProject
end
step 'I should see project "Enterprise"' do
page.should have_content "Enterprise"
expect(page).to have_content "Enterprise"
end
step 'I should not see project "Enterprise"' do
page.should_not have_content "Enterprise"
expect(page).not_to have_content "Enterprise"
end
step 'internal project "Internal"' do
......@@ -113,11 +113,11 @@ module SharedProject
end
step 'I should see project "Internal"' do
page.should have_content "Internal"
expect(page).to have_content "Internal"
end
step 'I should not see project "Internal"' do
page.should_not have_content "Internal"
expect(page).not_to have_content "Internal"
end
step 'public project "Community"' do
......@@ -125,11 +125,11 @@ module SharedProject
end
step 'I should see project "Community"' do
page.should have_content "Community"
expect(page).to have_content "Community"
end
step 'I should not see project "Community"' do
page.should_not have_content "Community"
expect(page).not_to have_content "Community"
end
step '"John Doe" owns private project "Enterprise"' do
......
......@@ -45,8 +45,8 @@ module SharedProjectTab
end
step 'the active main tab should be Settings' do
within '.nav-sidebar' do
page.should have_content('Back to project')
page.within '.nav-sidebar' do
expect(page).to have_content('Back to project')
end
end
end
......@@ -18,39 +18,39 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps
end
step 'I should see "line seven" in results' do
page.should have_content 'line seven'
expect(page).to have_content 'line seven'
end
step 'I should see "line four" in results' do
page.should have_content 'line four'
expect(page).to have_content 'line four'
end
step 'I should see "line ten" in results' do
page.should have_content 'line ten'
expect(page).to have_content 'line ten'
end
step 'I should not see "line eleven" in results' do
page.should_not have_content 'line eleven'
expect(page).not_to have_content 'line eleven'
end
step 'I should not see "line three" in results' do
page.should_not have_content 'line three'
expect(page).not_to have_content 'line three'
end
step 'I should see "Personal snippet one" in results' do
page.should have_content 'Personal snippet one'
expect(page).to have_content 'Personal snippet one'
end
step 'I should see "Personal snippet private" in results' do
page.should have_content 'Personal snippet private'
expect(page).to have_content 'Personal snippet private'
end
step 'I should not see "Personal snippet one" in results' do
page.should_not have_content 'Personal snippet one'
expect(page).not_to have_content 'Personal snippet one'
end
step 'I should not see "Personal snippet private" in results' do
page.should_not have_content 'Personal snippet private'
expect(page).not_to have_content 'Personal snippet private'
end
end
......@@ -4,15 +4,15 @@ class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps
include SharedSnippet
step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one"
expect(page).to have_content "Personal snippet one"
end
step 'I should see "Personal snippet internal" in snippets' do
page.should have_content "Personal snippet internal"
expect(page).to have_content "Personal snippet internal"
end
step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private"
expect(page).not_to have_content "Personal snippet private"
end
def snippet
......
......@@ -4,11 +4,11 @@ class Spinach::Features::PublicSnippets < Spinach::FeatureSteps
include SharedSnippet
step 'I should see snippet "Personal snippet one"' do
page.should have_no_xpath("//i[@class='public-snippet']")
expect(page).to have_no_xpath("//i[@class='public-snippet']")
end
step 'I should see raw snippet "Personal snippet one"' do
page.should have_text(snippet.content)
expect(page).to have_text(snippet.content)
end
step 'I visit snippet page "Personal snippet one"' do
......
......@@ -9,11 +9,11 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end
step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one"
expect(page).not_to have_content "Personal snippet one"
end
step 'I click link "Edit"' do
within ".file-title" do
page.within ".file-title" do
click_link "Edit"
end
end
......@@ -25,15 +25,15 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
step 'I submit new snippet "Personal snippet three"' do
fill_in "personal_snippet_title", :with => "Personal snippet three"
fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do
page.within('.file-editor') do
find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of snippet three'
end
click_button "Create snippet"
end
step 'I should see snippet "Personal snippet three"' do
page.should have_content "Personal snippet three"
page.should have_content "Content of snippet three"
expect(page).to have_content "Personal snippet three"
expect(page).to have_content "Content of snippet three"
end
step 'I submit new title "Personal snippet new title"' do
......@@ -42,7 +42,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end
step 'I should see "Personal snippet new title"' do
page.should have_content "Personal snippet new title"
expect(page).to have_content "Personal snippet new title"
end
step 'I uncheck "Private" checkbox' do
......@@ -51,7 +51,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end
step 'I should see "Personal snippet one" public' do
page.should have_no_xpath("//i[@class='public-snippet']")
expect(page).to have_no_xpath("//i[@class='public-snippet']")
end
step 'I visit snippet page "Personal snippet one"' do
......
......@@ -8,43 +8,43 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
end
step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one"
expect(page).to have_content "Personal snippet one"
end
step 'I should see "Personal snippet private" in snippets' do
page.should have_content "Personal snippet private"
expect(page).to have_content "Personal snippet private"
end
step 'I should see "Personal snippet internal" in snippets' do
page.should have_content "Personal snippet internal"
expect(page).to have_content "Personal snippet internal"
end
step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one"
expect(page).not_to have_content "Personal snippet one"
end
step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private"
expect(page).not_to have_content "Personal snippet private"
end
step 'I should not see "Personal snippet internal" in snippets' do
page.should_not have_content "Personal snippet internal"
expect(page).not_to have_content "Personal snippet internal"
end
step 'I click "Internal" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Internal"
end
end
step 'I click "Private" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Private"
end
end
step 'I click "Public" filter' do
within('.nav-tabs') do
page.within('.nav-tabs') do
click_link "Public"
end
end
......
......@@ -28,13 +28,13 @@ class Spinach::Features::User < Spinach::FeatureSteps
end
step 'I should see contributed projects' do
within '.contributed-projects' do
page.should have_content(@contributed_project.name)
page.within '.contributed-projects' do
expect(page).to have_content(@contributed_project.name)
end
end
step 'I should see contributions calendar' do
page.should have_css('.cal-heatmap-container')
expect(page).to have_css('.cal-heatmap-container')
end
def contributed_project
......
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