Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-12 10:51:31 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-12 10:51:31 +0300
commit319704451233f4abfbb0e4bcc9bb3e0a756f5eb1 (patch)
tree84bf4724b4079e05f6230ca4dcc88f9f41ed8532 /spec
parent31bcd04711d448c016506897b8431273e3454faa (diff)
Refactor push data builder. Moved it to separate class
Also execute GitLab CI on creating tag via UI
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/push_data_builder_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/push_data_builder_spec.rb b/spec/lib/gitlab/push_data_builder_spec.rb
new file mode 100644
index 00000000000..fbf767a167f
--- /dev/null
+++ b/spec/lib/gitlab/push_data_builder_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'Gitlab::PushDataBuilder' do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+
+
+ describe :build_sample do
+ let(:data) { Gitlab::PushDataBuilder.build_sample(project, user) }
+
+ it { data.should be_a(Hash) }
+ it { data[:before].should == '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' }
+ it { data[:after].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
+ it { data[:ref].should == 'refs/heads/master' }
+ it { data[:commits].size.should == 3 }
+ it { data[:total_commits_count].should == 3 }
+ end
+
+ describe :build do
+ let(:data) do
+ Gitlab::PushDataBuilder.build(project,
+ user,
+ Gitlab::Git::BLANK_SHA,
+ '5937ac0a7beb003549fc5fd26fc247adbce4a52e',
+ 'refs/tags/v1.1.0')
+ end
+
+ it { data.should be_a(Hash) }
+ it { data[:before].should == Gitlab::Git::BLANK_SHA }
+ it { data[:after].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
+ it { data[:ref].should == 'refs/tags/v1.1.0' }
+ it { data[:commits].should be_empty }
+ it { data[:total_commits_count].should be_zero }
+ end
+end