summaryrefslogtreecommitdiff
path: root/spec/models/group_spec.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-05 17:55:48 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-07 15:35:12 +0900
commit5cb45b6a44a2cefff4f9cd7d5fd0b98b51416e94 (patch)
tree7e61820f5d13b39f3f4be554abf348b34330e84a /spec/models/group_spec.rb
parentbd846f7d93d1c7fd1d7ffdf097be88cf4ddf6581 (diff)
downloadgitlab-ce-5cb45b6a44a2cefff4f9cd7d5fd0b98b51416e94.tar.gz
Add CASE When Clause for saving order when using where IN
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index dab33aa4418..399020953e8 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -466,14 +466,21 @@ describe Group, models: true do
it_behaves_like 'ref is protected'
end
- context 'when group has a child' do
- let!(:group_child) { create(:group, :access_requestable, parent: group) }
+ context 'when group has children' do
+ let!(:group_child) { create(:group, parent: group) }
let!(:variable_child) { create(:ci_group_variable, group: group_child) }
-
- subject { group_child.secret_variables_for('ref', project) }
+ let!(:group_child_3) { create(:group, parent: group_child_2) }
+ let!(:variable_child_3) { create(:ci_group_variable, group: group_child_3) }
+ let!(:group_child_2) { create(:group, parent: group_child) }
+ let!(:variable_child_2) { create(:ci_group_variable, group: group_child_2) }
it 'returns all variables belong to the group and parent groups' do
- is_expected.to contain_exactly(secret_variable, protected_variable, variable_child)
+ expected_array1 = [protected_variable, secret_variable]
+ expected_array2 = [variable_child, variable_child_2, variable_child_3]
+ got_array = group_child_3.secret_variables_for('ref', project).to_a
+
+ expect(got_array.shift(2)).to contain_exactly(*expected_array1)
+ expect(got_array).to eq(expected_array2)
end
end
end