spec/client_spec.rb in adyen-ruby-api-library-3.0.2 vs spec/client_spec.rb in adyen-ruby-api-library-4.0.0
- old
+ new
@@ -36,9 +36,27 @@
expect{ @shared_values[:client].checkout.payment_methods("{}") }.
to raise_error(Adyen::AuthenticationError)
@shared_values[:client].api_key = "api_key"
end
+ it "uses the specified mock service URL" do
+ client = Adyen::Client.new(env: :mock, mock_service_url_base: "https://mock.test")
+ expect(client.service_url_base("Account")).
+ to eq("https://mock.test")
+ end
+
+ it "generates localhost service URL when a mock port is specified" do
+ client = Adyen::Client.new(env: :mock, mock_port: 3005)
+ expect(client.service_url_base("Account")).
+ to eq("http://localhost:3005")
+ end
+
+ it "prefers the mock service URL when both mock service URL and port are specified" do
+ client = Adyen::Client.new(env: :mock, mock_port: 3005, mock_service_url_base: "https://this-url-wins.test")
+ expect(client.service_url_base("Account")).
+ to eq("https://this-url-wins.test")
+ end
+
it "generates the correct service URL base for CAL TEST" do
client = Adyen::Client.new(env: :test)
client.live_url_prefix = "abcdef1234567890-TestCompany"
expect(client.service_url_base("Account")).
to eq("https://cal-test.adyen.com/cal/services")