Class: EndpointTest
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- EndpointTest
- Defined in:
- lib/kube/helm/endpoint.rb
Instance Method Summary collapse
- #test_equality ⇒ Object
- #test_http_chart_ref_raises_without_repo_name ⇒ Object
- #test_http_chart_ref_with_repo_name ⇒ Object
- #test_http_endpoint_not_oci ⇒ Object
- #test_http_requires_add ⇒ Object
- #test_inequality ⇒ Object
-
#test_oci_chart_ref ⇒ Object
── chart_ref ──────────────────────────────────────────────────────────.
- #test_oci_chart_ref_strips_trailing_slash ⇒ Object
-
#test_oci_does_not_require_add ⇒ Object
── requires_add? ─────────────────────────────────────────────────────.
-
#test_oci_endpoint_detected ⇒ Object
── OCI detection ──────────────────────────────────────────────────────.
-
#test_raises_on_empty_url ⇒ Object
── validation ─────────────────────────────────────────────────────────.
- #test_raises_on_non_string_url ⇒ Object
-
#test_to_s_returns_url ⇒ Object
── to_s / equality ───────────────────────────────────────────────────.
Instance Method Details
#test_equality ⇒ Object
149 150 151 152 153 |
# File 'lib/kube/helm/endpoint.rb', line 149 def test_equality a = Kube::Helm::Endpoint.new("https://charts.example.com") b = Kube::Helm::Endpoint.new("https://charts.example.com") assert_equal a, b end |
#test_http_chart_ref_raises_without_repo_name ⇒ Object
127 128 129 130 |
# File 'lib/kube/helm/endpoint.rb', line 127 def test_http_chart_ref_raises_without_repo_name endpoint = Kube::Helm::Endpoint.new("https://charts.bitnami.com/bitnami") assert_raises(ArgumentError) { endpoint.chart_ref("nginx") } end |
#test_http_chart_ref_with_repo_name ⇒ Object
122 123 124 125 |
# File 'lib/kube/helm/endpoint.rb', line 122 def test_http_chart_ref_with_repo_name endpoint = Kube::Helm::Endpoint.new("https://charts.bitnami.com/bitnami") assert_equal "bitnami/nginx", endpoint.chart_ref("nginx", repo_name: "bitnami") end |
#test_http_endpoint_not_oci ⇒ Object
93 94 95 96 |
# File 'lib/kube/helm/endpoint.rb', line 93 def test_http_endpoint_not_oci endpoint = Kube::Helm::Endpoint.new("https://charts.bitnami.com/bitnami") refute endpoint.oci? end |
#test_http_requires_add ⇒ Object
105 106 107 108 |
# File 'lib/kube/helm/endpoint.rb', line 105 def test_http_requires_add endpoint = Kube::Helm::Endpoint.new("https://charts.bitnami.com/bitnami") assert endpoint.requires_add? end |
#test_inequality ⇒ Object
155 156 157 158 159 |
# File 'lib/kube/helm/endpoint.rb', line 155 def test_inequality a = Kube::Helm::Endpoint.new("https://charts.example.com") b = Kube::Helm::Endpoint.new("oci://ghcr.io/my-org/charts") refute_equal a, b end |
#test_oci_chart_ref ⇒ Object
── chart_ref ──────────────────────────────────────────────────────────
112 113 114 115 |
# File 'lib/kube/helm/endpoint.rb', line 112 def test_oci_chart_ref endpoint = Kube::Helm::Endpoint.new("oci://ghcr.io/my-org/charts") assert_equal "oci://ghcr.io/my-org/charts/nginx", endpoint.chart_ref("nginx") end |
#test_oci_chart_ref_strips_trailing_slash ⇒ Object
117 118 119 120 |
# File 'lib/kube/helm/endpoint.rb', line 117 def test_oci_chart_ref_strips_trailing_slash endpoint = Kube::Helm::Endpoint.new("oci://ghcr.io/my-org/charts/") assert_equal "oci://ghcr.io/my-org/charts/nginx", endpoint.chart_ref("nginx") end |
#test_oci_does_not_require_add ⇒ Object
── requires_add? ─────────────────────────────────────────────────────
100 101 102 103 |
# File 'lib/kube/helm/endpoint.rb', line 100 def test_oci_does_not_require_add endpoint = Kube::Helm::Endpoint.new("oci://ghcr.io/my-org/charts") refute endpoint.requires_add? end |
#test_oci_endpoint_detected ⇒ Object
── OCI detection ──────────────────────────────────────────────────────
88 89 90 91 |
# File 'lib/kube/helm/endpoint.rb', line 88 def test_oci_endpoint_detected endpoint = Kube::Helm::Endpoint.new("oci://ghcr.io/my-org/charts") assert endpoint.oci? end |
#test_raises_on_empty_url ⇒ Object
── validation ─────────────────────────────────────────────────────────
134 135 136 |
# File 'lib/kube/helm/endpoint.rb', line 134 def test_raises_on_empty_url assert_raises(ArgumentError) { Kube::Helm::Endpoint.new("") } end |
#test_raises_on_non_string_url ⇒ Object
138 139 140 |
# File 'lib/kube/helm/endpoint.rb', line 138 def test_raises_on_non_string_url assert_raises(ArgumentError) { Kube::Helm::Endpoint.new(nil) } end |
#test_to_s_returns_url ⇒ Object
── to_s / equality ───────────────────────────────────────────────────
144 145 146 147 |
# File 'lib/kube/helm/endpoint.rb', line 144 def test_to_s_returns_url endpoint = Kube::Helm::Endpoint.new("https://charts.example.com") assert_equal "https://charts.example.com", endpoint.to_s end |