summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/admin/admin_hooks_spec.rb8
-rw-r--r--spec/requests/admin/admin_projects_spec.rb8
-rw-r--r--spec/requests/admin/admin_users_spec.rb10
-rw-r--r--spec/requests/api/issues_spec.rb6
-rw-r--r--spec/requests/api/merge_requests_spec.rb16
-rw-r--r--spec/requests/api/milestones_spec.rb6
-rw-r--r--spec/requests/api/projects_spec.rb18
-rw-r--r--spec/requests/api/session_spec.rb2
-rw-r--r--spec/requests/api/users_spec.rb12
-rw-r--r--spec/requests/atom/dashboard_issues_spec.rb10
-rw-r--r--spec/requests/atom/dashboard_spec.rb2
-rw-r--r--spec/requests/atom/issues_spec.rb6
-rw-r--r--spec/requests/gitlab_flavored_markdown_spec.rb38
-rw-r--r--spec/requests/issues_spec.rb34
-rw-r--r--spec/requests/projects_deploy_keys_spec.rb6
-rw-r--r--spec/requests/projects_spec.rb10
-rw-r--r--spec/requests/search_spec.rb4
-rw-r--r--spec/requests/security/profile_access_spec.rb2
-rw-r--r--spec/requests/snippets_spec.rb14
19 files changed, 106 insertions, 106 deletions
diff --git a/spec/requests/admin/admin_hooks_spec.rb b/spec/requests/admin/admin_hooks_spec.rb
index 2f026aabab8..3f35b2fd37d 100644
--- a/spec/requests/admin/admin_hooks_spec.rb
+++ b/spec/requests/admin/admin_hooks_spec.rb
@@ -2,12 +2,12 @@ require 'spec_helper'
describe "Admin::Hooks" do
before do
- @project = Factory :project,
- name: "LeGiT",
- code: "LGT"
+ @project = create(:project,
+ name: "LeGiT",
+ code: "LGT")
login_as :admin
- @system_hook = Factory :system_hook
+ @system_hook = create(:system_hook)
end
diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb
index 61e66eec08b..43e39d7cbcd 100644
--- a/spec/requests/admin/admin_projects_spec.rb
+++ b/spec/requests/admin/admin_projects_spec.rb
@@ -2,9 +2,9 @@ require 'spec_helper'
describe "Admin::Projects" do
before do
- @project = Factory :project,
- name: "LeGiT",
- code: "LGT"
+ @project = create(:project,
+ name: "LeGiT",
+ code: "LGT")
login_as :admin
end
@@ -104,7 +104,7 @@ describe "Admin::Projects" do
describe "Add new team member" do
before do
- @new_user = Factory :user
+ @new_user = create(:user)
visit admin_project_path(@project)
end
diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb
index 68358bf0a0f..9f43f07a476 100644
--- a/spec/requests/admin/admin_users_spec.rb
+++ b/spec/requests/admin/admin_users_spec.rb
@@ -76,7 +76,7 @@ describe "Admin::Users" do
describe "GET /admin/users/:id/edit" do
before do
- @simple_user = Factory :user
+ @simple_user = create(:user)
visit admin_users_path
click_link "edit_user_#{@simple_user.id}"
end
@@ -107,13 +107,13 @@ describe "Admin::Users" do
end
end
- describe "Add new project" do
- before do
- @new_project = Factory :project
+ describe "Add new project" do
+ before do
+ @new_project = create(:project)
visit admin_user_path(@user)
end
- it "should create new user" do
+ it "should create new user" do
select @new_project.name, from: "project_ids"
expect { click_button "Add" }.to change { UsersProject.count }.by(1)
page.should have_content @new_project.name
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index 442e9c730dc..6ea7e9b5579 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -3,9 +3,9 @@ require 'spec_helper'
describe Gitlab::API do
include ApiHelpers
- let(:user) { Factory :user }
- let!(:project) { Factory :project, owner: user }
- let!(:issue) { Factory :issue, author: user, assignee: user, project: project }
+ let(:user) { create(:user) }
+ let!(:project) { create(:project, owner: user) }
+ let!(:issue) { create(:issue, author: user, assignee: user, project: project) }
before { project.add_access(user, :read) }
describe "GET /issues" do
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index e1c7949f70c..e83f24671ed 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1,11 +1,11 @@
require "spec_helper"
-describe Gitlab::API do
+describe Gitlab::API do
include ApiHelpers
-
- let(:user) { Factory :user }
- let!(:project) { Factory :project, owner: user }
- let!(:merge_request) { Factory :merge_request, author: user, assignee: user, project: project, title: "Test" }
+
+ let(:user) { create(:user ) }
+ let!(:project) { create(:project, owner: user) }
+ let!(:merge_request) { create(:merge_request, author: user, assignee: user, project: project, title: "Test") }
before { project.add_access(user, :read) }
describe "GET /projects/:id/merge_requests" do
@@ -39,7 +39,7 @@ describe Gitlab::API do
post api("/projects/#{project.code}/merge_requests", user),
title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user
response.status.should == 201
- json_response['title'].should == 'Test merge_request'
+ json_response['title'].should == 'Test merge_request'
end
end
@@ -47,7 +47,7 @@ describe Gitlab::API do
it "should return merge_request" do
put api("/projects/#{project.code}/merge_request/#{merge_request.id}", user), title: "New title"
response.status.should == 200
- json_response['title'].should == 'New title'
+ json_response['title'].should == 'New title'
end
end
@@ -55,7 +55,7 @@ describe Gitlab::API do
it "should return comment" do
post api("/projects/#{project.code}/merge_request/#{merge_request.id}/comments", user), note: "My comment"
response.status.should == 201
- json_response['note'].should == 'My comment'
+ json_response['note'].should == 'My comment'
end
end
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb
index cf5f65f068c..860825ab2db 100644
--- a/spec/requests/api/milestones_spec.rb
+++ b/spec/requests/api/milestones_spec.rb
@@ -3,9 +3,9 @@ require 'spec_helper'
describe Gitlab::API do
include ApiHelpers
- let(:user) { Factory :user }
- let!(:project) { Factory :project, owner: user }
- let!(:milestone) { Factory :milestone, project: project }
+ let(:user) { create(:user) }
+ let!(:project) { create(:project, owner: user) }
+ let!(:milestone) { create(:milestone, project: project) }
before { project.add_access(user, :read) }
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 5f9a587d57a..d24ce43d3f2 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -3,14 +3,14 @@ require 'spec_helper'
describe Gitlab::API do
include ApiHelpers
- let(:user) { Factory :user }
- let(:user2) { Factory.create(:user) }
- let(:user3) { Factory.create(:user) }
- let!(:hook) { Factory :project_hook, project: project, url: "http://example.com" }
- let!(:project) { Factory :project, owner: user }
- let!(:snippet) { Factory :snippet, author: user, project: project, title: 'example' }
- let!(:users_project) { Factory :users_project, user: user, project: project, project_access: UsersProject::MASTER }
- let!(:users_project2) { Factory :users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER }
+ let(:user) { create(:user) }
+ let(:user2) { create(:user) }
+ let(:user3) { create(:user) }
+ let!(:hook) { create(:project_hook, project: project, url: "http://example.com") }
+ let!(:project) { create(:project, owner: user ) }
+ let!(:snippet) { create(:snippet, author: user, project: project, title: 'example') }
+ let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
+ let!(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) }
before { project.add_access(user, :read) }
describe "GET /projects" do
@@ -52,7 +52,7 @@ describe Gitlab::API do
end
it "should assign attributes to project" do
- project = Factory.attributes(:project, {
+ project = attributes_for(:project, {
path: 'path',
code: 'code',
description: Faker::Lorem.sentence,
diff --git a/spec/requests/api/session_spec.rb b/spec/requests/api/session_spec.rb
index f251f3921ac..afae8be8cbc 100644
--- a/spec/requests/api/session_spec.rb
+++ b/spec/requests/api/session_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::API do
include ApiHelpers
- let(:user) { Factory :user }
+ let(:user) { create(:user) }
describe "POST /session" do
context "when valid password" do
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 4c2e6adaf7f..4cfb4884e7c 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -3,9 +3,9 @@ require 'spec_helper'
describe Gitlab::API do
include ApiHelpers
- let(:user) { Factory :user }
- let(:admin) { Factory :admin }
- let(:key) { Factory :key, user: user }
+ let(:user) { create(:user) }
+ let(:admin) { create(:admin) }
+ let(:key) { create(:key, user: user) }
describe "GET /users" do
context "when unauthenticated" do
@@ -43,12 +43,12 @@ describe Gitlab::API do
it "should create user" do
expect {
- post api("/users", admin), Factory.attributes(:user, projects_limit: 3)
+ post api("/users", admin), attributes_for(:user, projects_limit: 3)
}.to change { User.count }.by(1)
end
it "shouldn't available for non admin users" do
- post api("/users", user), Factory.attributes(:user)
+ post api("/users", user), attributes_for(:user)
response.status.should == 403
end
end
@@ -103,7 +103,7 @@ describe Gitlab::API do
end
it "should create ssh key" do
- key_attrs = Factory.attributes :key
+ key_attrs = attributes_for :key
expect {
post api("/user/keys", user), key_attrs
}.to change{ user.keys.count }.by(1)
diff --git a/spec/requests/atom/dashboard_issues_spec.rb b/spec/requests/atom/dashboard_issues_spec.rb
index 8d1111fc770..8ce64cd4c14 100644
--- a/spec/requests/atom/dashboard_issues_spec.rb
+++ b/spec/requests/atom/dashboard_issues_spec.rb
@@ -2,11 +2,11 @@ require 'spec_helper'
describe "Dashboard Issues Feed" do
describe "GET /issues" do
- let!(:user) { Factory :user }
- let!(:project1) { Factory :project }
- let!(:project2) { Factory :project }
- let!(:issue1) { Factory :issue, author: user, assignee: user, project: project1 }
- let!(:issue2) { Factory :issue, author: user, assignee: user, project: project2 }
+ let!(:user) { create(:user) }
+ let!(:project1) { create(:project) }
+ let!(:project2) { create(:project) }
+ let!(:issue1) { create(:issue, author: user, assignee: user, project: project1) }
+ let!(:issue2) { create(:issue, author: user, assignee: user, project: project2) }
describe "atom feed" do
it "should render atom feed via private token" do
diff --git a/spec/requests/atom/dashboard_spec.rb b/spec/requests/atom/dashboard_spec.rb
index c160d24ac20..6257ad5c895 100644
--- a/spec/requests/atom/dashboard_spec.rb
+++ b/spec/requests/atom/dashboard_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "Dashboard Feed" do
describe "GET /" do
- let!(:user) { Factory :user }
+ let!(:user) { create(:user) }
context "projects atom feed via private token" do
it "should render projects atom feed" do
diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb
index c8671979870..29f88f3f1c3 100644
--- a/spec/requests/atom/issues_spec.rb
+++ b/spec/requests/atom/issues_spec.rb
@@ -2,9 +2,9 @@ require 'spec_helper'
describe "Issues Feed" do
describe "GET /issues" do
- let!(:user) { Factory :user }
- let!(:project) { Factory :project, owner: user }
- let!(:issue) { Factory :issue, author: user, project: project }
+ let!(:user) { create(:user) }
+ let!(:project) { create(:project, owner: user) }
+ let!(:issue) { create(:issue, author: user, project: project) }
before { project.add_access(user, :read, :write) }
diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb
index 014f99ebb0e..aedd435e617 100644
--- a/spec/requests/gitlab_flavored_markdown_spec.rb
+++ b/spec/requests/gitlab_flavored_markdown_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
describe "Gitlab Flavored Markdown" do
- let(:project) { Factory :project }
- let(:issue) { Factory :issue, project: project }
- let(:merge_request) { Factory :merge_request, project: project }
+ let(:project) { create(:project) }
+ let(:issue) { create(:issue, project: project) }
+ let(:merge_request) { create(:merge_request, project: project) }
let(:fred) do
- u = Factory :user, name: "fred"
+ u = create(:user, name: "fred")
project.users << u
u
end
@@ -84,16 +84,16 @@ describe "Gitlab Flavored Markdown" do
describe "for issues" do
before do
- @other_issue = Factory :issue,
+ @other_issue = create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project)
+ @issue = create(:issue,
author: @user,
assignee: @user,
- project: project
- @issue = Factory :issue,
- author: @user,
- assignee: @user,
- project: project,
- title: "fix ##{@other_issue.id}",
- description: "ask @#{fred.name} for details"
+ project: project,
+ title: "fix ##{@other_issue.id}",
+ description: "ask @#{fred.name} for details")
end
it "should render subject in issues#index" do
@@ -118,9 +118,9 @@ describe "Gitlab Flavored Markdown" do
describe "for merge requests" do
before do
- @merge_request = Factory :merge_request,
- project: project,
- title: "fix ##{issue.id}"
+ @merge_request = create(:merge_request,
+ project: project,
+ title: "fix ##{issue.id}")
end
it "should render title in merge_requests#index" do
@@ -139,10 +139,10 @@ describe "Gitlab Flavored Markdown" do
describe "for milestones" do
before do
- @milestone = Factory :milestone,
- project: project,
- title: "fix ##{issue.id}",
- description: "ask @#{fred.name} for details"
+ @milestone = create(:milestone,
+ project: project,
+ title: "fix ##{issue.id}",
+ description: "ask @#{fred.name} for details")
end
it "should render title in milestones#index" do
diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb
index 15ee5d174a0..c95409d3a5f 100644
--- a/spec/requests/issues_spec.rb
+++ b/spec/requests/issues_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
describe "Issues" do
- let(:project) { Factory :project }
+ let(:project) { create(:project) }
before do
login_as :user
- @user2 = Factory :user
+ @user2 = create(:user)
project.add_access(@user, :read, :write)
project.add_access(@user2, :read, :write)
@@ -13,10 +13,10 @@ describe "Issues" do
describe "Edit issue", js: true do
before do
- @issue = Factory :issue,
- author: @user,
- assignee: @user,
- project: project
+ @issue = create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project)
visit project_issues_path(project)
click_link "Edit"
end
@@ -46,11 +46,11 @@ describe "Issues" do
describe "Search issue", js: true do
before do
['foobar', 'foobar2', 'gitlab'].each do |title|
- @issue = Factory :issue,
- author: @user,
- assignee: @user,
- project: project,
- title: title
+ @issue = create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project,
+ title: title)
@issue.save
end
end
@@ -93,15 +93,15 @@ describe "Issues" do
describe "Filter issue" do
before do
['foobar', 'barbaz', 'gitlab'].each do |title|
- @issue = Factory :issue,
- author: @user,
- assignee: @user,
- project: project,
- title: title
+ @issue = create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project,
+ title: title)
end
@issue = Issue.first
- @issue.milestone = Factory(:milestone, project: project)
+ @issue.milestone = create(:milestone, project: project)
@issue.assignee = nil
@issue.save
end
diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb
index df1be79d2f5..35323f556f9 100644
--- a/spec/requests/projects_deploy_keys_spec.rb
+++ b/spec/requests/projects_deploy_keys_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "Projects", "DeployKeys" do
- let(:project) { Factory :project }
+ let(:project) { create(:project) }
before do
login_as :user
@@ -10,7 +10,7 @@ describe "Projects", "DeployKeys" do
describe "GET /keys" do
before do
- @key = Factory :key, project: project
+ @key = create(:key, project: project)
visit project_deploy_keys_path(project)
end
@@ -57,7 +57,7 @@ describe "Projects", "DeployKeys" do
describe "Show page" do
before do
- @key = Factory :key, project: project
+ @key = create(:key, project: project)
visit project_deploy_key_path(project, @key)
end
diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb
index 92e89a162af..c44bea89f96 100644
--- a/spec/requests/projects_spec.rb
+++ b/spec/requests/projects_spec.rb
@@ -6,7 +6,7 @@ describe "Projects" do
describe 'GET /project/new' do
it "should work autocomplete", :js => true do
visit new_project_path
-
+
fill_in 'project_name', with: 'Awesome'
find("#project_path").value.should == 'awesome'
find("#project_code").value.should == 'awesome'
@@ -15,7 +15,7 @@ describe "Projects" do
describe "GET /projects/show" do
before do
- @project = Factory :project, owner: @user
+ @project = create(:project, owner: @user)
@project.add_access(@user, :read)
visit project_path(@project)
@@ -28,7 +28,7 @@ describe "Projects" do
describe "GET /projects/:id/edit" do
before do
- @project = Factory :project
+ @project = create(:project)
@project.add_access(@user, :admin, :read)
visit edit_project_path(@project)
@@ -47,7 +47,7 @@ describe "Projects" do
describe "PUT /projects/:id" do
before do
- @project = Factory :project, owner: @user
+ @project = create(:project, owner: @user)
@project.add_access(@user, :admin, :read)
visit edit_project_path(@project)
@@ -69,7 +69,7 @@ describe "Projects" do
describe "DELETE /projects/:id" do
before do
- @project = Factory :project
+ @project = create(:project)
@project.add_access(@user, :read, :admin)
visit edit_project_path(@project)
end
diff --git a/spec/requests/search_spec.rb b/spec/requests/search_spec.rb
index 537c4d0c64c..17cc0d39946 100644
--- a/spec/requests/search_spec.rb
+++ b/spec/requests/search_spec.rb
@@ -3,14 +3,14 @@ require 'spec_helper'
describe "Search" do
before do
login_as :user
- @project = Factory :project
+ @project = create(:project)
@project.add_access(@user, :read)
visit search_path
fill_in "search", with: @project.name[0..3]
click_button "Search"
end
- it "should show project in search results" do
+ it "should show project in search results" do
page.should have_content @project.name
end
end
diff --git a/spec/requests/security/profile_access_spec.rb b/spec/requests/security/profile_access_spec.rb
index 69c1c29cf12..8562b8e78af 100644
--- a/spec/requests/security/profile_access_spec.rb
+++ b/spec/requests/security/profile_access_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe "Users Security" do
describe "Project" do
before do
- @u1 = Factory :user
+ @u1 = create(:user)
end
describe "GET /login" do
diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb
index 6b993660507..9ef217ba62c 100644
--- a/spec/requests/snippets_spec.rb
+++ b/spec/requests/snippets_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "Snippets" do
- let(:project) { Factory :project }
+ let(:project) { create(:project) }
before do
login_as :user
@@ -10,9 +10,9 @@ describe "Snippets" do
describe "GET /snippets" do
before do
- @snippet = Factory :snippet,
- author: @user,
- project: project
+ @snippet = create(:snippet,
+ author: @user,
+ project: project)
visit project_snippets_path(project)
end
@@ -68,9 +68,9 @@ describe "Snippets" do
describe "Edit snippet" do
before do
- @snippet = Factory :snippet,
- author: @user,
- project: project
+ @snippet = create(:snippet,
+ author: @user,
+ project: project)
visit project_snippet_path(project, @snippet)
click_link "Edit"
end