|
22 | 22 | describe '.cdn_base_postfix' do |
23 | 23 | before do |
24 | 24 | allow(Uploadcare.config).to receive(:cdn_base_postfix).and_return('https://ucarecd.net/') |
25 | | - allow(described_class).to receive(:generate_cname).and_return('abc123def') |
| 25 | + allow(described_class).to receive(:custom_cname).and_return('abc123def') |
26 | 26 | end |
27 | 27 |
|
28 | 28 | it 'generates subdomain CDN base with subdomain prefix' do |
|
33 | 33 | it 'handles different CDN bases' do |
34 | 34 | described_class.instance_variable_set(:@cdn_base_postfix, nil) |
35 | 35 | allow(Uploadcare.config).to receive(:cdn_base_postfix).and_return('https://example.com') |
36 | | - allow(described_class).to receive(:generate_cname).and_return('xyz789') |
| 36 | + allow(described_class).to receive(:custom_cname).and_return('xyz789') |
37 | 37 |
|
38 | 38 | result = described_class.cdn_base_postfix |
39 | 39 | expect(result).to eq('https://xyz789.example.com') |
|
44 | 44 | second_call = described_class.cdn_base_postfix |
45 | 45 |
|
46 | 46 | expect(first_call).to eq(second_call) |
47 | | - expect(described_class).to have_received(:generate_cname).once |
| 47 | + expect(described_class).to have_received(:custom_cname).once |
48 | 48 | end |
49 | 49 |
|
50 | 50 | it 'handles CDN base with path' do |
51 | 51 | described_class.instance_variable_set(:@cdn_base_postfix, nil) |
52 | 52 | allow(Uploadcare.config).to receive(:cdn_base_postfix).and_return('https://cdn.example.com/path/') |
53 | | - allow(described_class).to receive(:generate_cname).and_return('prefix123') |
| 53 | + allow(described_class).to receive(:custom_cname).and_return('prefix123') |
54 | 54 |
|
55 | 55 | result = described_class.cdn_base_postfix |
56 | 56 | expect(result).to eq('https://prefix123.cdn.example.com/path/') |
|
213 | 213 | test_cases.each do |cdn_base| |
214 | 214 | described_class.instance_variable_set(:@cdn_base_postfix, nil) |
215 | 215 | allow(Uploadcare.config).to receive(:cdn_base_postfix).and_return(cdn_base) |
216 | | - allow(described_class).to receive(:generate_cname).and_return('test123') |
| 216 | + allow(described_class).to receive(:custom_cname).and_return('test123') |
217 | 217 |
|
218 | 218 | result = described_class.cdn_base_postfix |
219 | 219 | expect(result).to include('test123.') |
|
0 commit comments