Skip to content
Snippets Groups Projects
Commit f9e6f668 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix tests

parent bdfb349f
No related branches found
No related tags found
No related merge requests found
Loading
@@ -32,14 +32,14 @@ describe "Admin::Users", feature: true do
Loading
@@ -32,14 +32,14 @@ describe "Admin::Users", feature: true do
   
it "should apply defaults to user" do it "should apply defaults to user" do
click_button "Create user" click_button "Create user"
user = User.last user = User.find_by(username: 'bang')
user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
end end
   
it "should create user with valid data" do it "should create user with valid data" do
click_button "Create user" click_button "Create user"
user = User.last user = User.find_by(username: 'bang')
user.name.should == "Big Bang" user.name.should == "Big Bang"
user.email.should == "bigbang@mail.com" user.email.should == "bigbang@mail.com"
end end
Loading
@@ -52,7 +52,7 @@ describe "Admin::Users", feature: true do
Loading
@@ -52,7 +52,7 @@ describe "Admin::Users", feature: true do
   
it "should send valid email to user with email & password" do it "should send valid email to user with email & password" do
click_button "Create user" click_button "Create user"
user = User.last user = User.find_by(username: 'bang')
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
email.subject.should have_content("Account was created") email.subject.should have_content("Account was created")
email.text_part.body.should have_content(user.email) email.text_part.body.should have_content(user.email)
Loading
Loading
require 'spec_helper' require 'spec_helper'
   
describe "Issues", feature: true do describe "Issues", feature: true do
include SortingHelper
let(:project) { create(:project) } let(:project) { create(:project) }
   
before do before do
Loading
@@ -80,7 +82,7 @@ describe "Issues", feature: true do
Loading
@@ -80,7 +82,7 @@ describe "Issues", feature: true do
title: title) title: title)
end end
   
@issue = Issue.first # with title 'foobar' @issue = Issue.find_by(title: 'foobar')
@issue.milestone = create(:milestone, project: project) @issue.milestone = create(:milestone, project: project)
@issue.assignee = nil @issue.assignee = nil
@issue.save @issue.save
Loading
@@ -130,14 +132,14 @@ describe "Issues", feature: true do
Loading
@@ -130,14 +132,14 @@ describe "Issues", feature: true do
let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') }
   
it 'sorts by newest' do it 'sorts by newest' do
visit project_issues_path(project, sort: 'newest') visit project_issues_path(project, sort: sort_value_recently_created)
   
first_issue.should include("foo") first_issue.should include("foo")
last_issue.should include("baz") last_issue.should include("baz")
end end
   
it 'sorts by oldest' do it 'sorts by oldest' do
visit project_issues_path(project, sort: 'oldest') visit project_issues_path(project, sort: sort_value_oldest_created)
   
first_issue.should include("baz") first_issue.should include("baz")
last_issue.should include("foo") last_issue.should include("foo")
Loading
@@ -146,7 +148,7 @@ describe "Issues", feature: true do
Loading
@@ -146,7 +148,7 @@ describe "Issues", feature: true do
it 'sorts by most recently updated' do it 'sorts by most recently updated' do
baz.updated_at = Time.now + 100 baz.updated_at = Time.now + 100
baz.save baz.save
visit project_issues_path(project, sort: 'recently_updated') visit project_issues_path(project, sort: sort_value_recently_updated)
   
first_issue.should include("baz") first_issue.should include("baz")
end end
Loading
@@ -154,7 +156,7 @@ describe "Issues", feature: true do
Loading
@@ -154,7 +156,7 @@ describe "Issues", feature: true do
it 'sorts by least recently updated' do it 'sorts by least recently updated' do
baz.updated_at = Time.now - 100 baz.updated_at = Time.now - 100
baz.save baz.save
visit project_issues_path(project, sort: 'last_updated') visit project_issues_path(project, sort: sort_value_oldest_updated)
   
first_issue.should include("baz") first_issue.should include("baz")
end end
Loading
@@ -168,13 +170,13 @@ describe "Issues", feature: true do
Loading
@@ -168,13 +170,13 @@ describe "Issues", feature: true do
end end
   
it 'sorts by recently due milestone' do it 'sorts by recently due milestone' do
visit project_issues_path(project, sort: 'milestone_due_soon') visit project_issues_path(project, sort: sort_value_milestone_soon)
   
first_issue.should include("foo") first_issue.should include("foo")
end end
   
it 'sorts by least recently due milestone' do it 'sorts by least recently due milestone' do
visit project_issues_path(project, sort: 'milestone_due_later') visit project_issues_path(project, sort: sort_value_milestone_later)
   
first_issue.should include("bar") first_issue.should include("bar")
end end
Loading
@@ -191,7 +193,7 @@ describe "Issues", feature: true do
Loading
@@ -191,7 +193,7 @@ describe "Issues", feature: true do
end end
   
it 'sorts with a filter applied' do it 'sorts with a filter applied' do
visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id) visit project_issues_path(project, sort: sort_value_oldest_created, assignee_id: user2.id)
   
first_issue.should include("bar") first_issue.should include("bar")
last_issue.should include("foo") last_issue.should include("foo")
Loading
Loading
Loading
@@ -26,7 +26,7 @@ describe API::API, api: true do
Loading
@@ -26,7 +26,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 3 json_response.length.should == 3
json_response.first['title'].should == merge_request.title json_response.last['title'].should == merge_request.title
end end
   
it "should return an array of all merge_requests" do it "should return an array of all merge_requests" do
Loading
@@ -34,7 +34,7 @@ describe API::API, api: true do
Loading
@@ -34,7 +34,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 3 json_response.length.should == 3
json_response.first['title'].should == merge_request.title json_response.last['title'].should == merge_request.title
end end
   
it "should return an array of open merge_requests" do it "should return an array of open merge_requests" do
Loading
@@ -42,7 +42,7 @@ describe API::API, api: true do
Loading
@@ -42,7 +42,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 1 json_response.length.should == 1
json_response.first['title'].should == merge_request.title json_response.last['title'].should == merge_request.title
end end
   
it "should return an array of closed merge_requests" do it "should return an array of closed merge_requests" do
Loading
@@ -50,8 +50,8 @@ describe API::API, api: true do
Loading
@@ -50,8 +50,8 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 2 json_response.length.should == 2
json_response.first['title'].should == merge_request_closed.title json_response.second['title'].should == merge_request_closed.title
json_response.second['title'].should == merge_request_merged.title json_response.first['title'].should == merge_request_merged.title
end end
   
it "should return an array of merged merge_requests" do it "should return an array of merged merge_requests" do
Loading
@@ -73,9 +73,10 @@ describe API::API, api: true do
Loading
@@ -73,9 +73,10 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 3 json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id json_response.last['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id json_response.first['id'].should == @mr_later.id
end end
it "should return an array of merge_requests in descending order" do it "should return an array of merge_requests in descending order" do
get api("/projects/#{project.id}/merge_requests?sort=desc", user) get api("/projects/#{project.id}/merge_requests?sort=desc", user)
response.status.should == 200 response.status.should == 200
Loading
@@ -84,21 +85,23 @@ describe API::API, api: true do
Loading
@@ -84,21 +85,23 @@ describe API::API, api: true do
json_response.first['id'].should == @mr_later.id json_response.first['id'].should == @mr_later.id
json_response.last['id'].should == @mr_earlier.id json_response.last['id'].should == @mr_earlier.id
end end
it "should return an array of merge_requests ordered by updated_at" do it "should return an array of merge_requests ordered by updated_at" do
get api("/projects/#{project.id}/merge_requests?order_by=updated_at", user) get api("/projects/#{project.id}/merge_requests?order_by=updated_at", user)
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 3 json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id json_response.last['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id json_response.first['id'].should == @mr_later.id
end end
it "should return an array of merge_requests ordered by created_at" do it "should return an array of merge_requests ordered by created_at" do
get api("/projects/#{project.id}/merge_requests?sort=created_at", user) get api("/projects/#{project.id}/merge_requests?sort=created_at", user)
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.length.should == 3 json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id json_response.last['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id json_response.first['id'].should == @mr_later.id
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment