|
259 | 259 | expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg?ik-sdk-version=ruby-#{ImageKitIo::Sdk::VERSION}&γειασας=γειασας") |
260 | 260 | end |
261 | 261 |
|
| 262 | + it 'test_generate_url_with_absolute_path' do |
| 263 | + options = { path: "https://example.com/external-image.jpg", |
| 264 | + query_parameters: { "γειασας": "γειασας" }, |
| 265 | + transformation: [{ height: 300, width: 400 }] |
| 266 | + } |
| 267 | + url = url_obj.generate_url(options) |
| 268 | + |
| 269 | + expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/https%3A%2F%2Fexample.com%2Fexternal-image.jpg?ik-sdk-version=ruby-#{ImageKitIo::Sdk::VERSION}&γειασας=γειασας") |
| 270 | + end |
| 271 | + |
262 | 272 | it "test_generate_url_with_src_checking_query_param_added" do |
263 | 273 |
|
264 | 274 | options = { src: "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?another=abc&xyz=888", |
|
360 | 370 | expect(url).to include("https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400/Fjällräven_KnSJwp87u6q.png?ik-sdk-version=ruby-#{ImageKitIo::Sdk::VERSION}&ik-s=") |
361 | 371 | end |
362 | 372 |
|
| 373 | + it 'test_generate_url_with_absolute_path_and_signed' do |
| 374 | + allow(url_obj).to receive(:get_signature_timestamp).with(5) { 100 } |
| 375 | + options = { path: "https://example.com/external-image.jpg", |
| 376 | + query_parameters: { "γειασας": "γειασας" }, |
| 377 | + transformation: [{ height: 300, width: 400 }], |
| 378 | + signed: true, |
| 379 | + expire_seconds: 5 |
| 380 | + } |
| 381 | + url = url_obj.generate_url(options) |
| 382 | + |
| 383 | + expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/https%3A%2F%2Fexample.com%2Fexternal-image.jpg?ik-sdk-version=ruby-#{ImageKitIo::Sdk::VERSION}&γειασας=γειασας&ik-s=1ce525443b5ea4f1e66e8e89d585a8c95ae043c2&ik-t=100") |
| 384 | + end |
| 385 | + |
363 | 386 | it "test_url_with_invalid_args_returns_as_it_is" do |
364 | 387 |
|
365 | 388 | options = { path: "/default-image.jpg", |
|
0 commit comments