BigW Consortium Gitlab

Commit f9e6f668 by Dmitriy Zaporozhets

Fix tests

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