|
133 | 133 | context 'completes duplicate process' do
|
134 | 134 | context 'and returns the new dashboard details' do
|
135 | 135 | specify do
|
136 |
| - expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2" }) |
| 136 | + expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2", published: false}) |
137 | 137 | end
|
138 | 138 | end
|
139 | 139 |
|
|
187 | 187 | expect(Superset::Dashboard::Embedded::Put).to_not receive(:new)
|
188 | 188 | end
|
189 | 189 |
|
190 |
| - specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2" }) } |
| 190 | + specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2", published: false}) } |
191 | 191 | end
|
192 | 192 |
|
193 | 193 | context 'are not empty' do
|
|
197 | 197 | expect(Superset::Dashboard::Embedded::Put).to receive(:new).with(dashboard_id: new_dashboard_id, allowed_domains: allowed_domains).and_return(double(result: { allowed_domains: allowed_domains }))
|
198 | 198 | end
|
199 | 199 |
|
200 |
| - specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2" }) } |
| 200 | + specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2", published: false}) } |
201 | 201 | end
|
202 | 202 | end
|
203 | 203 |
|
204 | 204 | context 'and tags' do
|
205 | 205 | context 'are empty' do
|
206 |
| - specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2" }) } |
| 206 | + specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2", published: false}) } |
207 | 207 | end
|
208 | 208 |
|
209 | 209 | context 'are not empty' do
|
|
213 | 213 | expect(Superset::Tag::AddToObject).to receive(:new).with(object_type_id: ObjectType::DASHBOARD, object_id: new_dashboard_id, tags: tags).and_return(double(perform: true))
|
214 | 214 | end
|
215 | 215 |
|
216 |
| - specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2" }) } |
| 216 | + specify { expect(subject.perform).to eq( { new_dashboard_id: 2, new_dashboard_url: "http://superset-host.com/superset/dashboard/2", published: false}) } |
217 | 217 | end
|
218 | 218 | end
|
219 | 219 |
|
| 220 | + context 'and publish attr is' do |
| 221 | + context 'excluded from params' do |
| 222 | + before do |
| 223 | + expect(Superset::Dashboard::Put).to_not receive(:new).with( |
| 224 | + target_dashboard_id: new_dashboard_id, |
| 225 | + params: { published: false }) |
| 226 | + end |
| 227 | + |
| 228 | + specify 'defaults to false' do |
| 229 | + expect(subject.perform).to eq( { |
| 230 | + new_dashboard_id: 2, |
| 231 | + new_dashboard_url: "http://superset-host.com/superset/dashboard/2", |
| 232 | + published: false |
| 233 | + }) |
| 234 | + end |
| 235 | + end |
| 236 | + |
| 237 | + context 'included in params as true' do |
| 238 | + subject { described_class.new( |
| 239 | + source_dashboard_id: source_dashboard_id, |
| 240 | + target_schema: target_schema, |
| 241 | + target_database_id: target_database_id, |
| 242 | + publish: true ) } |
| 243 | + |
| 244 | + before do |
| 245 | + expect(Superset::Dashboard::Put).to receive(:new).with( |
| 246 | + target_dashboard_id: new_dashboard_id, |
| 247 | + params: { published: true }).and_return(double(perform: true)) |
| 248 | + end |
| 249 | + |
| 250 | + specify { expect(subject.perform).to eq( { |
| 251 | + new_dashboard_id: 2, |
| 252 | + new_dashboard_url: "http://superset-host.com/superset/dashboard/2", |
| 253 | + published: true |
| 254 | + }) } |
| 255 | + end |
| 256 | + end |
220 | 257 | end
|
221 | 258 |
|
222 | 259 | context 'with invalid params' do
|
|
0 commit comments