diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-05 15:13:34 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-05 15:13:34 +0200 |
commit | f17c4950fa5a951102d5592dc962f20e302b44aa (patch) | |
tree | 9c6f7078d1db168d8154739d52fc062d5987c3c4 /spec/models | |
parent | 056df41ed16f6eddf3271caad93a118f97e8b58c (diff) | |
download | gitlab-ci-f17c4950fa5a951102d5592dc962f20e302b44aa.tar.gz |
Refactor commits/builds logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/build_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/commit_spec.rb | 23 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 39 |
3 files changed, 16 insertions, 52 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 753da0d..f8b44e1 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -207,7 +207,7 @@ describe Build do describe :allow_git_fetch do subject { build.allow_git_fetch } - it { should eq(commit.allow_git_fetch) } + it { should eq(project.allow_git_fetch) } end describe :project do @@ -225,13 +225,13 @@ describe Build do describe :project_name do subject { build.project_name } - it { should eq(commit.project_name) } + it { should eq(project.name) } end describe :repo_url do subject { build.repo_url } - it { should eq(commit.repo_url) } + it { should eq(project.repo_url_with_auth) } end describe :extract_coverage do diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 75f236b..2b14053 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -141,32 +141,9 @@ describe Commit do it { commit.sha.should start_with(subject) } end - describe :repo_url do - subject { commit_with_project.repo_url } - - it { should be_a(String) } - it { should end_with(".git") } - it { should start_with(project.gitlab_url[0..6]) } - it { should include(project.token) } - it { should include('gitlab-ci-token') } - it { should include(project.gitlab_url[7..-1]) } - end - describe :gitlab? do subject { commit_with_project.gitlab? } it { should eq(project.gitlab?) } end - - describe :allow_git_fetch do - subject { commit_with_project.allow_git_fetch } - - it { should eq(project.allow_git_fetch) } - end - - describe :name do - subject { commit_with_project.project_name } - - it { should eq(project.name) } - end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index fd33ddd..9e44542 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -58,7 +58,7 @@ describe Project do end it { project.status.should == 'pending' } - it { project.last_build.should be_kind_of(Build) } + it { project.last_commit.should be_kind_of(Commit) } it { project.human_status.should == 'pending' } end end @@ -122,29 +122,16 @@ describe Project do it { parsed_project.gitlab_id.should eq(189) } it { parsed_project.gitlab_url.should eq("http://localhost:3000/gitlab/api-gitlab-org") } end -end - -# == Schema Information -# -# Table name: projects -# -# id :integer not null, primary key -# name :string(255) not null -# timeout :integer default(1800), not null -# scripts :text default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# token :string(255) -# default_ref :string(255) -# gitlab_url :string(255) -# always_build :boolean default(FALSE), not null -# polling_interval :integer -# public :boolean default(FALSE), not null -# ssh_url_to_repo :string(255) -# gitlab_id :integer -# allow_git_fetch :boolean default(TRUE), not null -# email_recipients :string(255) -# email_add_committer :boolean default(TRUE), not null -# email_only_breaking_build :boolean default(TRUE), not null -# + describe :repo_url_with_auth do + let(:project) { FactoryGirl.create :project } + subject { project.repo_url_with_auth } + + it { should be_a(String) } + it { should end_with(".git") } + it { should start_with(project.gitlab_url[0..6]) } + it { should include(project.token) } + it { should include('gitlab-ci-token') } + it { should include(project.gitlab_url[7..-1]) } + end +end |