Skip to content

Commit f8f091f

Browse files
vipulnswardclaude
andcommitted
fix: update CnameGenerator specs to match implementation
Update test mocks to use custom_cname instead of generate_cname to align with the refactored implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 300427c commit f8f091f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/uploadcare/cname_generator_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
describe '.cdn_base_postfix' do
2323
before do
2424
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')
2626
end
2727

2828
it 'generates subdomain CDN base with subdomain prefix' do
@@ -33,7 +33,7 @@
3333
it 'handles different CDN bases' do
3434
described_class.instance_variable_set(:@cdn_base_postfix, nil)
3535
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')
3737

3838
result = described_class.cdn_base_postfix
3939
expect(result).to eq('https://xyz789.example.com')
@@ -44,13 +44,13 @@
4444
second_call = described_class.cdn_base_postfix
4545

4646
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
4848
end
4949

5050
it 'handles CDN base with path' do
5151
described_class.instance_variable_set(:@cdn_base_postfix, nil)
5252
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')
5454

5555
result = described_class.cdn_base_postfix
5656
expect(result).to eq('https://prefix123.cdn.example.com/path/')
@@ -213,7 +213,7 @@
213213
test_cases.each do |cdn_base|
214214
described_class.instance_variable_set(:@cdn_base_postfix, nil)
215215
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')
217217

218218
result = described_class.cdn_base_postfix
219219
expect(result).to include('test123.')

0 commit comments

Comments
 (0)