Commit ce84e3f440e5f737ca808fd88cf54caefeda6b81
1 parent
e65731bb
Exists in
master
and in
4 other branches
Fixed tests. added test for gitlab_ci_service model
Showing
5 changed files
with
51 additions
and
4 deletions
Show diff stats
| ... | ... | @@ -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
spec/models/merge_request_spec.rb
spec/models/milestone_spec.rb
spec/models/user_spec.rb
| ... | ... | @@ -162,6 +162,7 @@ describe User do |
| 162 | 162 | |
| 163 | 163 | describe 'filter' do |
| 164 | 164 | before do |
| 165 | + User.delete_all | |
| 165 | 166 | @user = create :user |
| 166 | 167 | @admin = create :user, admin: true |
| 167 | 168 | @blocked = create :user, blocked: true |
| ... | ... | @@ -175,6 +176,7 @@ describe User do |
| 175 | 176 | |
| 176 | 177 | describe :not_in_project do |
| 177 | 178 | before do |
| 179 | + User.delete_all | |
| 178 | 180 | @user = create :user |
| 179 | 181 | @project = create :project |
| 180 | 182 | end | ... | ... |