summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-01 17:54:44 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-01 17:54:44 +0300
commit9338ed0606913460f09d6e0633eb436a52491514 (patch)
tree5f17558958ac69fb00bed8b0f2e746437cac55fe /spec/models/project_spec.rb
parent7e1680934bbba7df0c7d4b2448e28bbd2d697168 (diff)
downloadgitlab-ce-9338ed0606913460f09d6e0633eb436a52491514.tar.gz
Fix project and notes specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb25
1 files changed, 11 insertions, 14 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index bc537b7312b..82ab97cdd7a 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -124,24 +124,21 @@ describe Project do
describe :update_merge_requests do
let(:project) { create(:project) }
-
- before do
- @merge_request = create(:merge_request, source_project: project, target_project: project)
- @key = create(:key, user_id: project.owner.id)
- end
+ let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
+ let(:key) { create(:key, user_id: project.owner.id) }
+ let(:prev_commit_id) { merge_request.commits.last.id }
+ let(:commit_id) { merge_request.commits.first.id }
it "should close merge request if last commit from source branch was pushed to target branch" do
- @merge_request.reload_code
- @merge_request.last_commit.id.should == "69b34b7e9ad9f496f0ad10250be37d6265a03bba"
- project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "69b34b7e9ad9f496f0ad10250be37d6265a03bba", "refs/heads/stable", @key.user)
- @merge_request.reload
- @merge_request.merged?.should be_true
+ project.update_merge_requests(prev_commit_id, commit_id, "refs/heads/#{merge_request.target_branch}", key.user)
+ merge_request.reload
+ merge_request.merged?.should be_true
end
it "should update merge request commits with new one if pushed to source branch" do
- project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "69b34b7e9ad9f496f0ad10250be37d6265a03bba", "refs/heads/master", @key.user)
- @merge_request.reload
- @merge_request.last_commit.id.should == "69b34b7e9ad9f496f0ad10250be37d6265a03bba"
+ project.update_merge_requests(prev_commit_id, commit_id, "refs/heads/#{merge_request.source_branch}", key.user)
+ merge_request.reload
+ merge_request.last_commit.id.should == commit_id
end
end
@@ -237,7 +234,7 @@ describe Project do
project.protected_branches.create(name: 'master')
end
- it { project.open_branches.map(&:name).should include('bootstrap') }
+ it { project.open_branches.map(&:name).should include('feature') }
it { project.open_branches.map(&:name).should_not include('master') }
end