summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/assembla_service_spec.rb9
-rw-r--r--spec/models/commit_spec.rb2
-rw-r--r--spec/models/flowdock_service_spec.rb2
-rw-r--r--spec/models/merge_request_spec.rb7
-rw-r--r--spec/models/note_spec.rb2
-rw-r--r--spec/models/project_spec.rb15
-rw-r--r--spec/models/service_spec.rb4
7 files changed, 20 insertions, 21 deletions
diff --git a/spec/models/assembla_service_spec.rb b/spec/models/assembla_service_spec.rb
index 0b961c81ac1..395aa4a4444 100644
--- a/spec/models/assembla_service_spec.rb
+++ b/spec/models/assembla_service_spec.rb
@@ -25,7 +25,7 @@ describe AssemblaService do
describe "Execute" do
let(:user) { create(:user) }
- let(:project) { create(:project_with_code) }
+ let(:project) { create(:project) }
before do
@assembla_service = AssemblaService.new
@@ -33,14 +33,15 @@ describe AssemblaService do
project_id: project.id,
project: project,
service_hook: true,
- token: 'verySecret'
+ token: 'verySecret',
+ subdomain: 'project_name'
)
@sample_data = GitPushService.new.sample_data(project, user)
- @api_url = 'https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=verySecret'
+ @api_url = 'https://atlas.assembla.com/spaces/project_name/github_tool?secret_key=verySecret'
WebMock.stub_request(:post, @api_url)
end
- it "should call FlowDock API" do
+ it "should call Assembla API" do
@assembla_service.execute(@sample_data)
WebMock.should have_requested(:post, @api_url).with(
body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index fa556f94a1d..d8ab171d3ee 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Commit do
- let(:project) { create :project_with_code }
+ let(:project) { create :project }
let(:commit) { project.repository.commit }
describe '#title' do
diff --git a/spec/models/flowdock_service_spec.rb b/spec/models/flowdock_service_spec.rb
index 636aba2f012..cd553b33ad7 100644
--- a/spec/models/flowdock_service_spec.rb
+++ b/spec/models/flowdock_service_spec.rb
@@ -25,7 +25,7 @@ describe FlowdockService do
describe "Execute" do
let(:user) { create(:user) }
- let(:project) { create(:project_with_code) }
+ let(:project) { create(:project) }
before do
@flowdock_service = FlowdockService.new
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 039a0c087ba..f1ad679b658 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -73,14 +73,13 @@ describe MergeRequest do
describe '#for_fork?' do
it 'returns true if the merge request is for a fork' do
- subject.source_project = create(:source_project)
- subject.target_project = create(:target_project)
+ subject.source_project = create(:project, namespace: create(:group))
+ subject.target_project = create(:project, namespace: create(:group))
subject.for_fork?.should be_true
end
+
it 'returns false if is not for a fork' do
- subject.source_project = create(:source_project)
- subject.target_project = subject.source_project
subject.for_fork?.should be_false
end
end
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index b86603dd4ac..7a00ee83ba4 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -206,7 +206,7 @@ describe Note do
end
describe '#create_cross_reference_note' do
- let(:project) { create(:project_with_code) }
+ let(:project) { create(:project) }
let(:author) { create(:user) }
let(:issue) { create(:issue, project: project) }
let(:mergereq) { create(:merge_request, target_project: project) }
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 4aef70e90fe..6837e4c9196 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -128,7 +128,7 @@ describe Project do
end
describe :update_merge_requests do
- let(:project) { create(:project_with_code) }
+ let(:project) { create(:project) }
before do
@merge_request = create(:merge_request, source_project: project, target_project: project)
@@ -136,7 +136,7 @@ describe Project do
end
it "should close merge request if last commit from source branch was pushed to target branch" do
- @merge_request.reloaded_commits
+ @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
@@ -144,7 +144,6 @@ describe Project do
end
it "should update merge request commits with new one if pushed to source branch" do
- @merge_request.last_commit.should == nil
project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "69b34b7e9ad9f496f0ad10250be37d6265a03bba", "refs/heads/master", @key.user)
@merge_request.reload
@merge_request.last_commit.id.should == "69b34b7e9ad9f496f0ad10250be37d6265a03bba"
@@ -156,10 +155,10 @@ describe Project do
context 'with namespace' do
before do
@group = create :group, name: 'gitlab'
- @project = create(:project, name: 'gitlab-ci', namespace: @group)
+ @project = create(:project, name: 'gitlabhq', namespace: @group)
end
- it { Project.find_with_namespace('gitlab/gitlab-ci').should == @project }
+ it { Project.find_with_namespace('gitlab/gitlabhq').should == @project }
it { Project.find_with_namespace('gitlab-ci').should be_nil }
end
end
@@ -168,10 +167,10 @@ describe Project do
context 'with namespace' do
before do
@group = create :group, name: 'gitlab'
- @project = create(:project, name: 'gitlab-ci', namespace: @group)
+ @project = create(:project, name: 'gitlabhq', namespace: @group)
end
- it { @project.to_param.should == "gitlab/gitlab-ci" }
+ it { @project.to_param.should == "gitlab/gitlabhq" }
end
end
@@ -237,7 +236,7 @@ describe Project do
end
describe :open_branches do
- let(:project) { create(:project_with_code) }
+ let(:project) { create(:project) }
before do
project.protected_branches.create(name: 'master')
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index 667c80bcf19..46b3bf39aeb 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -44,12 +44,12 @@ describe Service do
end
describe :can_test do
- it { @testable.should == false }
+ it { @testable.should == true }
end
end
describe "With commits" do
- let (:project) { create :project_with_code }
+ let (:project) { create :project }
before do
@service.stub(