Commit 519275c1 authored by tiagonbotelho's avatar tiagonbotelho

fixes part1 of files to start using active tense

parent 551ffc0a
......@@ -39,7 +39,7 @@ describe Admin::UsersController do
user.ldap_block
end
it 'will not unblock user' do
it 'does not unblock user' do
put :unblock, id: user.username
user.reload
expect(user.blocked?).to be_truthy
......
......@@ -5,7 +5,7 @@ describe ApplicationController do
let(:user) { create(:user) }
let(:controller) { ApplicationController.new }
it 'should redirect if the user is over their password expiry' do
it 'redirects if the user is over their password expiry' do
user.password_expires_at = Time.new(2002)
expect(user.ldap_user?).to be_falsey
allow(controller).to receive(:current_user).and_return(user)
......@@ -14,7 +14,7 @@ describe ApplicationController do
controller.send(:check_password_expiration)
end
it 'should not redirect if the user is under their password expiry' do
it 'does not redirect if the user is under their password expiry' do
user.password_expires_at = Time.now + 20010101
expect(user.ldap_user?).to be_falsey
allow(controller).to receive(:current_user).and_return(user)
......@@ -22,7 +22,7 @@ describe ApplicationController do
controller.send(:check_password_expiration)
end
it 'should not redirect if the user is over their password expiry but they are an ldap user' do
it 'does not redirect if the user is over their password expiry but they are an ldap user' do
user.password_expires_at = Time.new(2002)
allow(user).to receive(:ldap_user?).and_return(true)
allow(controller).to receive(:current_user).and_return(user)
......
......@@ -9,7 +9,7 @@ describe Groups::AvatarsController do
sign_in(user)
end
it 'destroy should remove avatar from DB' do
it 'removes avatar from DB calling destroy' do
delete :destroy, group_id: group.path
@group = assigns(:group)
expect(@group.avatar.present?).to be_falsey
......
......@@ -15,7 +15,7 @@ describe Groups::MilestonesController do
end
describe "#create" do
it "should create group milestone with Chinese title" do
it "creates group milestone with Chinese title" do
post :create,
group_id: group.id,
milestone: { project_ids: [project.id, project2.id], title: title }
......
......@@ -8,7 +8,7 @@ describe Profiles::AvatarsController do
controller.instance_variable_set(:@user, user)
end
it 'destroy should remove avatar from DB' do
it 'removes avatar from DB by calling destroy' do
delete :destroy
@user = assigns(:user)
expect(@user.avatar.present?).to be_falsey
......
......@@ -6,7 +6,7 @@ describe Profiles::KeysController do
describe '#new' do
before { sign_in(user) }
it 'redirect to #index' do
it 'redirects to #index' do
get :new
expect(response).to redirect_to(profile_keys_path)
......@@ -15,7 +15,7 @@ describe Profiles::KeysController do
describe "#get_keys" do
describe "non existant user" do
it "should generally not work" do
it "does not generally work" do
get :get_keys, username: 'not-existent'
expect(response).not_to be_success
......@@ -23,19 +23,19 @@ describe Profiles::KeysController do
end
describe "user with no keys" do
it "should generally work" do
it "does generally work" do
get :get_keys, username: user.username
expect(response).to be_success
end
it "should render all keys separated with a new line" do
it "renders all keys separated with a new line" do
get :get_keys, username: user.username
expect(response.body).to eq("")
end
it "should respond with text/plain content type" do
it "responds with text/plain content type" do
get :get_keys, username: user.username
expect(response.content_type).to eq("text/plain")
end
......@@ -47,13 +47,13 @@ describe Profiles::KeysController do
user.keys << create(:another_key)
end
it "should generally work" do
it "does generally work" do
get :get_keys, username: user.username
expect(response).to be_success
end
it "should render all keys separated with a new line" do
it "renders all keys separated with a new line" do
get :get_keys, username: user.username
expect(response.body).not_to eq("")
......@@ -65,13 +65,13 @@ describe Profiles::KeysController do
expect(response.body).to match(/AQDmTillFzNTrrGgwaCKaSj/)
end
it "should not render the comment of the key" do
it "does not render the comment of the key" do
get :get_keys, username: user.username
expect(response.body).not_to match(/dummy@gitlab.com/)
end
it "should respond with text/plain content type" do
it "responds with text/plain content type" do
get :get_keys, username: user.username
expect(response.content_type).to eq("text/plain")
end
......
......@@ -10,7 +10,7 @@ describe Projects::AvatarsController do
controller.instance_variable_set(:@project, project)
end
it 'destroy should remove avatar from DB' do
it 'removes avatar from DB by calling destroy' do
delete :destroy, namespace_id: project.namespace.id, project_id: project.id
expect(project.avatar.present?).to be_falsey
expect(project).to be_valid
......
......@@ -47,25 +47,25 @@ describe Projects::CommitController do
end
shared_examples "export as" do |format|
it "should generally work" do
it "does generally work" do
go(id: commit.id, format: format)
expect(response).to be_success
end
it "should generate it" do
it "generates it" do
expect_any_instance_of(Commit).to receive(:"to_#{format}")
go(id: commit.id, format: format)
end
it "should render it" do
it "renders it" do
go(id: commit.id, format: format)
expect(response.body).to eq(commit.send(:"to_#{format}"))
end
it "should not escape Html" do
it "does not escape Html" do
allow_any_instance_of(Commit).to receive(:"to_#{format}").
and_return('HTML entities &<>" ')
......@@ -88,7 +88,7 @@ describe Projects::CommitController do
expect(response.body).to start_with("diff --git")
end
it "should really only be a git diff without whitespace changes" do
it "is only be a git diff without whitespace changes" do
go(id: '66eceea0db202bb39c4e445e8ca28689645366c5', format: format, w: 1)
expect(response.body).to start_with("diff --git")
......@@ -103,13 +103,13 @@ describe Projects::CommitController do
include_examples "export as", :patch
let(:format) { :patch }
it "should really be a git email patch" do
it "is a git email patch" do
go(id: commit.id, format: format)
expect(response.body).to start_with("From #{commit.id}")
end
it "should contain a git diff" do
it "contains a git diff" do
go(id: commit.id, format: format)
expect(response.body).to match(/^diff --git/)
......@@ -147,7 +147,7 @@ describe Projects::CommitController do
describe 'POST revert' do
context 'when target branch is not provided' do
it 'should render the 404 page' do
it 'renders the 404 page' do
post(:revert,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -159,7 +159,7 @@ describe Projects::CommitController do
end
context 'when the revert was successful' do
it 'should redirect to the commits page' do
it 'redirects to the commits page' do
post(:revert,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -180,7 +180,7 @@ describe Projects::CommitController do
id: commit.id)
end
it 'should redirect to the commit page' do
it 'redirects to the commit page' do
# Reverting a commit that has been already reverted.
post(:revert,
namespace_id: project.namespace.to_param,
......@@ -196,7 +196,7 @@ describe Projects::CommitController do
describe 'POST cherry_pick' do
context 'when target branch is not provided' do
it 'should render the 404 page' do
it 'renders the 404 page' do
post(:cherry_pick,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -208,7 +208,7 @@ describe Projects::CommitController do
end
context 'when the cherry-pick was successful' do
it 'should redirect to the commits page' do
it 'redirects to the commits page' do
post(:cherry_pick,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -229,7 +229,7 @@ describe Projects::CommitController do
id: master_pickable_commit.id)
end
it 'should redirect to the commit page' do
it 'redirects to the commit page' do
# Cherry-picking a commit that has been already cherry-picked.
post(:cherry_pick,
namespace_id: project.namespace.to_param,
......
......@@ -11,7 +11,7 @@ describe Projects::CommitsController do
describe "GET show" do
context "as atom feed" do
it "should render as atom" do
it "renders as atom" do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......
......@@ -11,7 +11,7 @@ describe Projects::CompareController do
project.team << [user, :master]
end
it 'compare should show some diffs' do
it 'compare shows some diffs' do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -23,7 +23,7 @@ describe Projects::CompareController do
expect(assigns(:commits).length).to be >= 1
end
it 'compare should show some diffs with ignore whitespace change option' do
it 'compare shows some diffs with ignore whitespace change option' do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -41,7 +41,7 @@ describe Projects::CompareController do
end
describe 'non-existent refs' do
it 'invalid source ref' do
it 'uses invalid source ref' do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -53,7 +53,7 @@ describe Projects::CompareController do
expect(assigns(:commits)).to eq([])
end
it 'invalid target ref' do
it 'uses invalid target ref' do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......
......@@ -16,7 +16,7 @@ describe Projects::ForksController do
context 'when fork is public' do
before { forked_project.update_attribute(:visibility_level, Project::PUBLIC) }
it 'should be visible for non logged in users' do
it 'is visible for non logged in users' do
get_forks
expect(assigns[:forks]).to be_present
......@@ -28,7 +28,7 @@ describe Projects::ForksController do
forked_project.update_attributes(visibility_level: Project::PRIVATE, group: group)
end
it 'should not be visible for non logged in users' do
it 'is not be visible for non logged in users' do
get_forks
expect(assigns[:forks]).to be_blank
......@@ -38,7 +38,7 @@ describe Projects::ForksController do
before { sign_in(project.creator) }
context 'when user is not a Project member neither a group member' do
it 'should not see the Project listed' do
it 'does not see the Project listed' do
get_forks
expect(assigns[:forks]).to be_blank
......@@ -48,7 +48,7 @@ describe Projects::ForksController do
context 'when user is a member of the Project' do
before { forked_project.team << [project.creator, :developer] }
it 'should see the project listed' do
it 'sees the project listed' do
get_forks
expect(assigns[:forks]).to be_present
......@@ -58,7 +58,7 @@ describe Projects::ForksController do
context 'when user is a member of the Group' do
before { forked_project.group.add_developer(project.creator) }
it 'should see the project listed' do
it 'sees the project listed' do
get_forks
expect(assigns[:forks]).to be_present
......
......@@ -30,7 +30,7 @@ describe Projects::IssuesController do
expect(response).to have_http_status(200)
end
it "return 301 if request path doesn't match project path" do
it "returns 301 if request path doesn't match project path" do
get :index, namespace_id: project.namespace.path, project_id: project.path.upcase
expect(response).to redirect_to(namespace_project_issues_path(project.namespace, project))
......@@ -119,21 +119,21 @@ describe Projects::IssuesController do
let!(:request_forgery_timing_attack) { create(:issue, :confidential, project: project, assignee: assignee) }
describe 'GET #index' do
it 'should not list confidential issues for guests' do
it 'does not list confidential issues for guests' do
sign_out(:user)
get_issues
expect(assigns(:issues)).to eq [issue]
end
it 'should not list confidential issues for non project members' do
it 'does not list confidential issues for non project members' do
sign_in(non_member)
get_issues
expect(assigns(:issues)).to eq [issue]
end
it 'should not list confidential issues for project members with guest role' do
it 'does not list confidential issues for project members with guest role' do
sign_in(member)
project.team << [member, :guest]
......@@ -142,7 +142,7 @@ describe Projects::IssuesController do
expect(assigns(:issues)).to eq [issue]
end
it 'should list confidential issues for author' do
it 'lists confidential issues for author' do
sign_in(author)
get_issues
......@@ -150,7 +150,7 @@ describe Projects::IssuesController do
expect(assigns(:issues)).not_to include request_forgery_timing_attack
end
it 'should list confidential issues for assignee' do
it 'lists confidential issues for assignee' do
sign_in(assignee)
get_issues
......@@ -158,7 +158,7 @@ describe Projects::IssuesController do
expect(assigns(:issues)).to include request_forgery_timing_attack
end
it 'should list confidential issues for project members' do
it 'lists confidential issues for project members' do
sign_in(member)
project.team << [member, :developer]
......@@ -168,7 +168,7 @@ describe Projects::IssuesController do
expect(assigns(:issues)).to include request_forgery_timing_attack
end
it 'should list confidential issues for admin' do
it 'lists confidential issues for admin' do
sign_in(admin)
get_issues
......
......@@ -36,7 +36,7 @@ describe Projects::MergeRequestsController do
describe "GET show" do
shared_examples "export merge as" do |format|
it "should generally work" do
it "does generally work" do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -46,7 +46,7 @@ describe Projects::MergeRequestsController do
expect(response).to be_success
end
it "should generate it" do
it "generates it" do
expect_any_instance_of(MergeRequest).to receive(:"to_#{format}")
get(:show,
......@@ -56,7 +56,7 @@ describe Projects::MergeRequestsController do
format: format)
end
it "should render it" do
it "renders it" do
get(:show,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
......@@ -66,7 +66,7 @@ describe Projects::MergeRequestsController do
expect(response.body).to eq(merge_request.send(:"to_#{format}").to_s)
end
it "should not escape Html" do
it "does not escape Html" do
allow_any_instance_of(MergeRequest).to receive(:"to_#{format}").
and_return('HTML entities &<>" ')
......@@ -118,7 +118,7 @@ describe Projects::MergeRequestsController do
context 'when filtering by opened state' do
context 'with opened merge requests' do
it 'should list those merge requests' do
it 'lists those merge requests' do
get_merge_requests
expect(assigns(:merge_requests)).to include(merge_request)
......@@ -131,7 +131,7 @@ describe Projects::MergeRequestsController do
merge_request.reopen!
end
it 'should list those merge requests' do
it 'lists those merge requests' do
get_merge_requests
expect(assigns(:merge_requests)).to include(merge_request)
......
......@@ -14,7 +14,7 @@ describe Projects::MilestonesController do
end
describe "#destroy" do
it "should remove milestone" do
it "removes milestone" do
expect(issue.milestone_id).to eq(milestone.id)
delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :js
......
......@@ -167,7 +167,7 @@ describe Projects::ProjectMembersController do
sign_in(user)
end
it 'cannot remove himself from the project' do
it 'does not remove himself from the project' do
delete :leave, namespace_id: project.namespace,
project_id: project
......
......@@ -3,7 +3,7 @@ require('spec_helper')
describe Projects::ProtectedBranchesController do
describe "GET #index" do
let(:project) { create(:project_empty_repo, :public) }
it "redirect empty repo to projects page" do
it "redirects empty repo to projects page" do
get(:index, namespace_id: project.namespace.to_param, project_id: project.to_param)
end
end
......
......@@ -24,7 +24,7 @@ describe Projects::RawController do
context 'image header' do
let(:id) { 'master/files/images/6049019_460s.jpg' }
it 'set image content type header' do
it 'sets image content type header' do
get(:show,
namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param,
......
......@@ -19,7 +19,7 @@ describe Projects::ServicesController do
describe "#test" do
context 'success' do
it "should redirect and show success message" do
it "redirects and show success message" do
expect(service).to receive(:test).and_return({ success: true, result: 'done' })
get :test, namespace_id: project.namespace.id, project_id: project.id, id: service.id, format: :html
expect(response.status).to redirect_to('/')
......@@ -28,7 +28,7 @@ describe Projects::ServicesController do
end
context 'failure' do
it "should redirect and show failure message" do
it "redirects and show failure message" do
expect(service).to receive(:test).and_return({ success: false, result: 'Bad test' })
get :test, namespace_id: project.namespace.id, project_id: project.id, id: service.id, format: :html
expect(response.status).to redirect_to('/')
......
......@@ -128,7 +128,7 @@ describe ProjectsController do
context "when the url contains .atom" do
let(:public_project_with_dot_atom) { build(:project, :public, name: 'my.atom', path: 'my.atom') }
it 'expect an error creating the project' do
it 'expects an error creating the project' do
expect(public_project_with_dot_atom).not_to be_valid
end
end
......@@ -222,7 +222,7 @@ describe ProjectsController do
create(:forked_project_link, forked_to_project: project_fork)
end
it 'should remove fork from project' do
it 'removes fork from project' do
delete(:remove_fork,
namespace_id: project_fork.namespace.to_param,
id: project_fork.to_param, format: :js)
......@@ -236,7 +236,7 @@ describe ProjectsController do
context 'when project not forked' do
let(:unforked_project) { create(:project, namespace: user.namespace) }
it 'should do nothing if project was not forked' do
it 'does nothing if project was not forked' do
delete(:remove_fork,
namespace_id: unforked_project.namespace.to_param,
id: unforked_project.to_param, format: :js)
......@@ -256,7 +256,7 @@ describe ProjectsController do
end
describe "GET refs" do
it "should get a list of branches and tags" do
it "gets a list of branches and tags" do
get :refs, namespace_id: public_project.namespace.path, id: public_project.path
parsed_body = JSON.parse(response.body)
......@@ -265,7 +265,7 @@ describe ProjectsController do
expect(parsed_body["Commits"]).to be_nil
end
it "should get a list of branches, tags and commits" do
it "gets a list of branches, tags and commits" do
get :refs, namespace_id: public_project.namespace.path, id: public_project.path, ref: "123456"
parsed_body = JSON.parse(response.body)
......
......@@ -11,7 +11,7 @@ describe "Admin::AbuseReports", feature: true, js: true do
end
describe 'in the abuse report view' do
it "should present a link to the user's profile" do
it "presents a link to the user's profile" do
visit admin_abuse_reports_path
expect(page).to have_link user.name, href: user_path(user)
......@@ -19,7 +19,7 @@ describe "Admin::AbuseReports", feature: true, js: true do
end
describe 'in the profile page of the user' do
it 'should show a link to the admin view of the user' do
it 'shows a link to the admin view of the user' do
visit user_path(user)
expect(page).to have_link '', href: admin_user_path(user)
......
......@@ -9,7 +9,7 @@ describe "Admin::Hooks", feature: true do
end
describe "GET /admin/hooks" do
it "should be ok" do
it "is ok" do
visit admin_root_path
page.within ".layout-nav" do
......@@ -19,7 +19,7 @@ describe "Admin::Hooks", feature: true do
expect(current_path).to eq(admin_hooks_path)
end
it "should have hooks list" do
it "has hooks list" do
visit admin_hooks_path
expect(page).to have_content(@system_hook.url)
end
......@@ -33,7 +33,7 @@ describe "Admin::Hooks", feature: true do
expect { click_button "Add System Hook" }.to change(SystemHook, :count).by(1)
end
it "should open new hook popup" do
it "opens new hook popup" do
expect(current_path).to eq(admin_hooks_path)
expect(page).to have_content(@url)
end
......
......@@ -11,11 +11,11 @@ describe "Admin::Projects", feature: true do
visit admin_namespaces_projects_path
end
it "should be ok" do
it "is ok" do
expect(current_path).to eq(admin_namespaces_projects_path)
end
it "should have projects list" do
it "has projects list" do
expect(page).to have_content(@project.name)
end
end
......@@ -26,7 +26,7 @@ describe "Admin::Projects", feature: true do
click_link "#{@project.name}"
end
it "should have project info" do
it "has project info" do
expect(page).to have_content(@project.path)
expect(page).to have_content(@project.name)
end
......
......@@ -8,11 +8,11 @@ describe "Admin::Users", feature: true do
visit admin_users_path
end
it "should be ok" do
it "is ok" do
expect(current_path).to eq(admin_users_path)
end
it "should have users list" do
it "has users list" do
expect(page).to have_content(@user.email)
expect(page).to have_content(@user.name)
end
......@@ -66,11 +66,11 @@ describe "Admin::Users", feature: true do
fill_in "user_email", with: "bigbang@mail.com"
end
it "should create new user" do
it "creates new user" do
expect { click_button "Create user" }.to change {User.count}.by(1)
end
it "should apply defaults to user" do
it "applies defaults to user" do
click_button "Create user"
user = User.find_by(username: 'bang')
expect(user.projects_limit).
......@@ -79,20 +79,20 @@ describe "Admin::Users", feature: true do
to eq(Gitlab.config.gitlab.default_can_create_group)
end
it "should create user with valid data" do
it "creates user with valid data" do
click_button "Create user"
user = User.find_by(username: 'bang')
expect(user.name).to eq('Big Bang')
expect(user.email).to eq('bigbang@mail.com')
end
it "should call send mail" do
it "calls send mail" do
expect_any_instance_of(NotificationService).to receive(:new_user)
click_button "Create user"
end
it "should send valid email to user with email & password" do
it "sends valid email to user with email & password" do
perform_enqueued_jobs do
click_button "Create user"
end
......@@ -106,7 +106,7 @@ describe "Admin::Users", feature: true do
end
describe "GET /admin/users/:id" do
it "should have user info" do
it "has user info" do
visit admin_users_path
click_link @user.name
......@@ -123,13 +123,13 @@ describe "Admin::Users", feature: true do
expect(page).to have_content('Impersonate')
end
it 'should not show impersonate button for admin itself' do
it 'does not show impersonate button for admin itself' do