Skip to content

Commit ce84e3f

Browse files
committed
Fixed tests. added test for gitlab_ci_service model
1 parent e65731b commit ce84e3f

File tree

5 files changed

+51
-4
lines changed

5 files changed

+51
-4
lines changed

spec/models/gitlab_ci_service_spec.rb

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# == Schema Information
2+
#
3+
# Table name: services
4+
#
5+
# id :integer not null, primary key
6+
# type :string(255)
7+
# title :string(255)
8+
# token :string(255)
9+
# project_id :integer not null
10+
# created_at :datetime not null
11+
# updated_at :datetime not null
12+
# active :boolean default(FALSE), not null
13+
# project_url :string(255)
14+
#
15+
16+
require 'spec_helper'
17+
18+
describe GitlabCiService do
19+
describe "Associations" do
20+
it { should belong_to :project }
21+
it { should have_one :service_hook }
22+
end
23+
24+
describe "Mass assignment" do
25+
it { should_not allow_mass_assignment_of(:project_id) }
26+
end
27+
28+
describe 'commits methods' do
29+
before do
30+
@service = GitlabCiService.new
31+
@service.stub(
32+
service_hook: true,
33+
project_url: 'http://ci.gitlab.org/projects/2',
34+
token: 'verySecret'
35+
)
36+
end
37+
38+
describe :commit_badge_path do
39+
it { @service.commit_badge_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/status?sha=2ab7834c"}
40+
end
41+
42+
describe :commit_status_path do
43+
it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"}
44+
end
45+
end
46+
end

spec/models/issue_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
end
3434

3535
describe 'modules' do
36-
it { should include_module(IssueCommonality) }
37-
it { should include_module(Votes) }
36+
it { should include_module(Issuable) }
3837
end
3938

4039
subject { create(:issue) }

spec/models/merge_request_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
end
3434

3535
describe 'modules' do
36-
it { should include_module(IssueCommonality) }
37-
it { should include_module(Votes) }
36+
it { should include_module(Issuable) }
3837
end
3938

4039
describe "#mr_and_commit_notes" do

spec/models/milestone_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
end
4141

4242
it "should count closed issues" do
43+
IssueObserver.current_user = issue.author
4344
issue.update_attributes(closed: true)
4445
milestone.issues << issue
4546
milestone.percent_complete.should == 100

spec/models/user_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162

163163
describe 'filter' do
164164
before do
165+
User.delete_all
165166
@user = create :user
166167
@admin = create :user, admin: true
167168
@blocked = create :user, blocked: true
@@ -175,6 +176,7 @@
175176

176177
describe :not_in_project do
177178
before do
179+
User.delete_all
178180
@user = create :user
179181
@project = create :project
180182
end

0 commit comments

Comments
 (0)