imgix 3.3.1 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class UrlTest < Imgix::Test
6
- DEMO_IMAGE_PATH = '/images/demo.png'
7
-
8
- def test_signing_with_no_params
9
- path = client.path(DEMO_IMAGE_PATH)
10
-
11
- assert_equal 'https://demo.imgix.net/images/demo.png?s=2c7c157eaf23b06a0deb2f60b81938c4', path.to_url
12
- end
13
-
14
- def test_signing_with_one
15
- path = client.path(DEMO_IMAGE_PATH)
16
-
17
- assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
18
- "will be removed in the next major version (along " \
19
- "with all parameter `ALIASES`).\n") {
20
- path.width = 200
21
- }
22
-
23
- assert_equal 'https://demo.imgix.net/images/demo.png?w=200&s=da421114ca238d1f4a927b889f67c34e', path.to_url
24
- end
25
-
26
- def test_signing_with_multiple_params
27
- path = client.path(DEMO_IMAGE_PATH)
28
-
29
- assert_output(nil, "Warning: `Path.height=' has been deprecated and " \
30
- "will be removed in the next major version (along " \
31
- "with all parameter `ALIASES`).\n") {
32
- path.height = 200
33
- }
34
-
35
- assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
36
- "will be removed in the next major version (along " \
37
- "with all parameter `ALIASES`).\n") {
38
- path.width = 200
39
- }
40
-
41
- assert_equal 'https://demo.imgix.net/images/demo.png?h=200&w=200&s=d570a1ecd765470f7b34a69b56718a7a', path.to_url
42
-
43
- path = client.path(DEMO_IMAGE_PATH)
44
-
45
- assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
46
- "will be removed in the next major version (along " \
47
- "with all parameter `ALIASES`).\n") {
48
- path.width = 200
49
- }
50
-
51
- assert_output(nil, "Warning: `Path.height=' has been deprecated and " \
52
- "will be removed in the next major version (along " \
53
- "with all parameter `ALIASES`).\n") {
54
- path.height = 200
55
- }
56
-
57
- assert_equal 'https://demo.imgix.net/images/demo.png?w=200&h=200&s=00b5cde5c7b8bca8618cb911da4ac379', path.to_url
58
- end
59
-
60
- def test_domain_resolves_host_warn
61
- assert_output(nil, "Warning: The identifier `host' has been deprecated and " \
62
- "will\nappear as `domain' in the next major version, e.g. " \
63
- "`@host'\nbecomes `@domain', `options[:host]' becomes " \
64
- "`options[:domain]'.\n") {
65
- Imgix::Client.new(host: 'demo.imgix.net', include_library_param: false)
66
- }
67
-
68
-
69
- # Assert the output of this call (to both stdout and stderr) is nil.
70
- assert_output(nil, nil) {
71
- Imgix::Client.new(domain: 'demo.imgix.net', include_library_param: false)
72
- }
73
- end
74
-
75
- private
76
-
77
- def client
78
- @client ||= Imgix::Client.new(host: 'demo.imgix.net', secure_url_token: '10adc394', include_library_param: false)
79
- end
80
- end