|
3 | 3 |
|
4 | 4 | require_relative 'shared_examples_for_user_actions' |
5 | 5 |
|
| 6 | +shared_context 'using mode with custom_id' do |
| 7 | + let(:CSV) { double('CSV') } |
| 8 | + |
| 9 | + before do |
| 10 | + allow(project).to receive(:metadata).and_return( |
| 11 | + 'GOODOT_CUSTOM_PROJECT_ID' => 'project-123' |
| 12 | + ) |
| 13 | + allow(project).to receive(:uri).and_return('project-uri') |
| 14 | + allow(project).to receive(:add_data_permissions) |
| 15 | + allow(domain).to receive(:clients).and_return([]) |
| 16 | + allow(data_source).to receive(:realize).and_return('filepath') |
| 17 | + end |
| 18 | +end |
| 19 | + |
6 | 20 | describe GoodData::LCM2::SynchronizeUserFilters do |
7 | 21 | let(:client) { double('client') } |
8 | 22 | let(:user) { double('user') } |
|
76 | 90 | end |
77 | 91 |
|
78 | 92 | context 'when using sync_one_project_based_on_custom_id mode with multiple_projects_column' do |
| 93 | + include_context 'using mode with custom_id' |
79 | 94 | let(:params) do |
80 | 95 | params = { |
81 | 96 | GDC_GD_CLIENT: client, |
|
88 | 103 | } |
89 | 104 | GoodData::LCM2.convert_to_smart_hash(params) |
90 | 105 | end |
91 | | - let(:CSV) { double('CSV') } |
92 | | - |
93 | | - before do |
94 | | - allow(project).to receive(:metadata).and_return( |
95 | | - 'GOODOT_CUSTOM_PROJECT_ID' => 'project-123' |
96 | | - ) |
97 | | - allow(project).to receive(:uri).and_return('project-uri') |
98 | | - allow(project).to receive(:add_data_permissions) |
99 | | - allow(domain).to receive(:clients).and_return([]) |
100 | | - allow(data_source).to receive(:realize).and_return('filepath') |
101 | | - end |
102 | 106 |
|
103 | 107 | context 'when params do not match client data in domain' do |
104 | 108 | before do |
|
143 | 147 | end |
144 | 148 | end |
145 | 149 | end |
| 150 | + |
| 151 | + context 'when using sync_multiple_projects_based_on_custom_id mode' do |
| 152 | + include_context 'using mode with custom_id' |
| 153 | + let(:params) do |
| 154 | + params = { |
| 155 | + input_source: 'foo', |
| 156 | + domain: 'bar', |
| 157 | + multiple_projects_column: 'id_column', |
| 158 | + sync_mode: 'sync_multiple_projects_based_on_custom_id', |
| 159 | + gdc_logger: logger, |
| 160 | + GDC_GD_CLIENT: client, |
| 161 | + filters_config: { labels: [] } |
| 162 | + } |
| 163 | + GoodData::LCM2.convert_to_smart_hash(params) |
| 164 | + end |
| 165 | + |
| 166 | + it 'fails if the MUF set is empty' do |
| 167 | + expect(File).to receive(:open) |
| 168 | + expect(CSV).to receive(:foreach) |
| 169 | + expect { subject.class.call(params) }.to raise_error(/The filter set can not be empty/) |
| 170 | + end |
| 171 | + end |
146 | 172 | end |
0 commit comments