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 @@ | @@ -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
| @@ -33,8 +33,7 @@ describe Issue do | @@ -33,8 +33,7 @@ describe Issue do | ||
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | describe 'modules' do | 35 | describe 'modules' do |
| 36 | - it { should include_module(IssueCommonality) } | ||
| 37 | - it { should include_module(Votes) } | 36 | + it { should include_module(Issuable) } |
| 38 | end | 37 | end |
| 39 | 38 | ||
| 40 | subject { create(:issue) } | 39 | subject { create(:issue) } |
spec/models/merge_request_spec.rb
| @@ -33,8 +33,7 @@ describe MergeRequest do | @@ -33,8 +33,7 @@ describe MergeRequest do | ||
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | describe 'modules' do | 35 | describe 'modules' do |
| 36 | - it { should include_module(IssueCommonality) } | ||
| 37 | - it { should include_module(Votes) } | 36 | + it { should include_module(Issuable) } |
| 38 | end | 37 | end |
| 39 | 38 | ||
| 40 | describe "#mr_and_commit_notes" do | 39 | describe "#mr_and_commit_notes" do |
spec/models/milestone_spec.rb
| @@ -40,6 +40,7 @@ describe Milestone do | @@ -40,6 +40,7 @@ describe Milestone do | ||
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | it "should count closed issues" do | 42 | it "should count closed issues" do |
| 43 | + IssueObserver.current_user = issue.author | ||
| 43 | issue.update_attributes(closed: true) | 44 | issue.update_attributes(closed: true) |
| 44 | milestone.issues << issue | 45 | milestone.issues << issue |
| 45 | milestone.percent_complete.should == 100 | 46 | milestone.percent_complete.should == 100 |
spec/models/user_spec.rb
| @@ -162,6 +162,7 @@ describe User do | @@ -162,6 +162,7 @@ describe User do | ||
| 162 | 162 | ||
| 163 | describe 'filter' do | 163 | describe 'filter' do |
| 164 | before do | 164 | before do |
| 165 | + User.delete_all | ||
| 165 | @user = create :user | 166 | @user = create :user |
| 166 | @admin = create :user, admin: true | 167 | @admin = create :user, admin: true |
| 167 | @blocked = create :user, blocked: true | 168 | @blocked = create :user, blocked: true |
| @@ -175,6 +176,7 @@ describe User do | @@ -175,6 +176,7 @@ describe User do | ||
| 175 | 176 | ||
| 176 | describe :not_in_project do | 177 | describe :not_in_project do |
| 177 | before do | 178 | before do |
| 179 | + User.delete_all | ||
| 178 | @user = create :user | 180 | @user = create :user |
| 179 | @project = create :project | 181 | @project = create :project |
| 180 | end | 182 | end |