• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-ruby / #5867

18 Apr 2024 09:24PM UTC coverage: 92.724% (-4.8%) from 97.485%
#5867

push

github

ramya-stripe
Bump version to 11.2.0

10067 of 10857 relevant lines covered (92.72%)

258.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.89
/test/stripe_test.rb
1
# frozen_string_literal: true
2

3
require File.expand_path("test_helper", __dir__)
1✔
4

5
class StripeTest < Test::Unit::TestCase
1✔
6
  should "allow app_info to be configured" do
1✔
7
    begin
×
8
      old = Stripe.app_info
2✔
9
      Stripe.set_app_info(
1✔
10
        "MyAwesomePlugin",
11
        partner_id: "partner_1234",
12
        url: "https://myawesomeplugin.info",
13
        version: "1.2.34"
14
      )
15
      assert_equal({
2✔
16
        name: "MyAwesomePlugin",
17
        partner_id: "partner_1234",
18
        url: "https://myawesomeplugin.info",
19
        version: "1.2.34",
20
      }, Stripe.app_info)
×
21
    ensure
22
      Stripe.app_info = old
1✔
23
    end
24
  end
25

26
  context "forwardable configurations" do
1✔
27
    context "internal configurations" do
1✔
28
      should "return the certificate store" do
1✔
29
        assert Stripe.ca_store.is_a?(OpenSSL::X509::Store)
1✔
30
      end
31

32
      should "return the max_network_retry_delay" do
1✔
33
        assert_equal 2, Stripe.max_network_retry_delay
1✔
34
      end
35

36
      should "return the initial_network_retry_delay" do
1✔
37
        assert_equal 0.5, Stripe.initial_network_retry_delay
1✔
38
      end
39
    end
40

41
    should "allow ca_bundle_path to be configured" do
1✔
42
      Stripe::StripeClient.expects(:clear_all_connection_managers)
1✔
43
      Stripe.ca_bundle_path = "/path/to/ca/bundle"
1✔
44
      assert_equal "/path/to/ca/bundle", Stripe.ca_bundle_path
1✔
45
    end
46

47
    should "allow open timeout to be configured" do
1✔
48
      Stripe.open_timeout = 10
1✔
49
      assert_equal 10, Stripe.open_timeout
1✔
50
    end
51

52
    should "allow read timeout to be configured" do
1✔
53
      Stripe.read_timeout = 10
1✔
54
      assert_equal 10, Stripe.read_timeout
1✔
55
    end
56

57
    if WRITE_TIMEOUT_SUPPORTED
1✔
58
      should "allow write timeout to be configured" do
1✔
59
        Stripe.write_timeout = 10
1✔
60
        assert_equal 10, Stripe.write_timeout
1✔
61
      end
62
    else
63
      should "raise when write timeout to be configured is not supported" do
×
64
        assert_raises NotImplementedError do
×
65
          Stripe.write_timeout = 10
×
66
        end
67
      end
68
    end
69

70
    should "allow api_key to be configured" do
1✔
71
      Stripe.api_key = "sk_local_test"
1✔
72
      assert_equal "sk_local_test", Stripe.api_key
1✔
73
    end
74

75
    should "allow stripe_account to be configured" do
1✔
76
      Stripe.stripe_account = "acct_1234"
1✔
77
      assert_equal "acct_1234", Stripe.stripe_account
1✔
78
    end
79

80
    should "allow enable_telemetry to be configured" do
1✔
81
      begin
×
82
        old = Stripe.enable_telemetry?
2✔
83

84
        Stripe.enable_telemetry = false
1✔
85
        assert_equal false, Stripe.enable_telemetry?
1✔
86
      ensure
87
        Stripe.enable_telemetry = old
1✔
88
      end
89
    end
90

91
    should "allow log_level to be configured" do
1✔
92
      Stripe.log_level = "debug"
1✔
93
      assert_equal ::Logger::DEBUG, Stripe.log_level
1✔
94
    end
95

96
    should "allow logger to be configured" do
1✔
97
      logger = Object.new
1✔
98
      Stripe.logger = logger
1✔
99
      assert_equal logger, Stripe.logger
1✔
100
    end
101

102
    should "allow proxy to be configured" do
1✔
103
      Stripe.proxy = "http://proxy"
1✔
104
      assert_equal "http://proxy", Stripe.proxy
1✔
105
    end
106

107
    should "allow uploads_base to be configured" do
1✔
108
      Stripe.uploads_base = "https://other.stripe.com"
1✔
109
      assert_equal "https://other.stripe.com", Stripe.uploads_base
1✔
110
    end
111

112
    should "allow api_base to be configured" do
1✔
113
      Stripe.api_base = "https://other.stripe.com"
1✔
114
      assert_equal "https://other.stripe.com", Stripe.api_base
1✔
115
    end
116

117
    should "allow api_version to be configured" do
1✔
118
      Stripe.api_version = "2018-02-28"
1✔
119
      assert_equal "2018-02-28", Stripe.api_version
1✔
120
    end
121

122
    should "allow connect_base to be configured" do
1✔
123
      Stripe.connect_base = "https://other.stripe.com"
1✔
124
      assert_equal "https://other.stripe.com", Stripe.connect_base
1✔
125
    end
126

127
    should "allow verify_ssl_certs to be configured" do
1✔
128
      Stripe.verify_ssl_certs = false
1✔
129
      assert_equal false, Stripe.verify_ssl_certs
1✔
130
    end
131

132
    should "allow client_id to be configured" do
1✔
133
      Stripe.client_id = "client"
1✔
134
      assert_equal "client", Stripe.client_id
1✔
135
    end
136
  end
137
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc