summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-08 20:24:00 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-03 02:11:51 +0900
commit175800299bf497591e625e82fd71420644c0bc6b (patch)
treedd2a089a7124806a6cd71ac2208268a16f75dc71 /spec/finders
parent83d02a0b609ea71ef8448b9012221962dda69aba (diff)
downloadgitlab-ce-175800299bf497591e625e82fd71420644c0bc6b.tar.gz
Add name(User)
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/pipelines_finder_spec.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb
index 3a840eca44f..8e214a71a32 100644
--- a/spec/finders/pipelines_finder_spec.rb
+++ b/spec/finders/pipelines_finder_spec.rb
@@ -134,13 +134,31 @@ describe PipelinesFinder do
end
context 'when a ref does not exist' do
- let(:params) { { ref: 'unique-ref' } }
+ let(:params) { { ref: 'invalid-ref' } }
it 'selects nothing' do
expect(subject).to be_empty
end
end
- end
+ end
+
+ context 'when a name is passed' do
+ context 'when a name exists' do
+ let(:params) { { name: user1.name } }
+
+ it 'selects all pipelines which belong to the name' do
+ expect(subject).to match_array(Ci::Pipeline.where(user: user1))
+ end
+ end
+
+ context 'when a name does not exist' do
+ let(:params) { { name: 'invalid-name' } }
+
+ it 'selects nothing' do
+ expect(subject).to be_empty
+ end
+ end
+ end
context 'when a username is passed' do
context 'when a username exists' do
@@ -152,13 +170,13 @@ describe PipelinesFinder do
end
context 'when a username does not exist' do
- let(:params) { { username: 'unique-username' } }
+ let(:params) { { username: 'invalid-username' } }
it 'selects nothing' do
expect(subject).to be_empty
end
end
- end
+ end
context 'when a yaml_errors is passed' do
context 'when yaml_errors is true' do
@@ -204,7 +222,7 @@ describe PipelinesFinder do
end
context 'when order_by does not exist' do
- let(:params) { { order_by: 'abnormal_column', sort: 'desc' } }
+ let(:params) { { order_by: 'invalid_column', sort: 'desc' } }
it 'sorts by default' do
expect(subject).to match_array(Ci::Pipeline.order(id: :desc))
@@ -212,7 +230,7 @@ describe PipelinesFinder do
end
context 'when sort does not exist' do
- let(:params) { { order_by: 'created_at', sort: 'abnormal_sort' } }
+ let(:params) { { order_by: 'created_at', sort: 'invalid_sort' } }
it 'sorts by default' do
expect(subject).to match_array(Ci::Pipeline.order(id: :desc))