Sha256: 2c7f5f93db15dd43e2425a1cdc841539bac8fe7c539b5b1501f4b7d9948151f0

Contents?: true

Size: 1.72 KB

Versions: 22

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

require ::File.expand_path("../../../test_helper", __FILE__)

module Stripe
  module Terminal
    class LocationTest < Test::Unit::TestCase
      should "be creatable" do
        location = Stripe::Terminal::Location.create(
          address: {
            line1: "line1",
            country: "US",
            postal_code: "12345",
            city: "San Francisco",
            state: "CA",
          },
          display_name: "name"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/locations"
        assert location.is_a?(Stripe::Terminal::Location)
      end

      should "be listable" do
        locations = Stripe::Terminal::Location.list
        assert_requested :get, "#{Stripe.api_base}/v1/terminal/locations"
        assert locations.data.is_a?(Array)
        assert locations.data[0].is_a?(Stripe::Terminal::Location)
      end

      should "be retrievable" do
        location = Stripe::Terminal::Location.retrieve("loc_123")
        assert_requested :get, "#{Stripe.api_base}/v1/terminal/locations/loc_123"
        assert location.is_a?(Stripe::Terminal::Location)
      end

      should "be saveable" do
        location = Stripe::Terminal::Location.retrieve("loc_123")
        location["display_name"] = "new name"
        location.save
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/locations/loc_123"
        assert location.is_a?(Stripe::Terminal::Location)
      end

      should "be updateable" do
        location = Stripe::Terminal::Location.update("loc_123", display_name: "new name")
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/locations/loc_123"
        assert location.is_a?(Stripe::Terminal::Location)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
stripe-4.9.1 test/stripe/terminal/location_test.rb
stripe-4.9.0 test/stripe/terminal/location_test.rb
stripe-4.8.1 test/stripe/terminal/location_test.rb
stripe-4.8.0 test/stripe/terminal/location_test.rb
stripe-4.7.1 test/stripe/terminal/location_test.rb
stripe-4.7.0 test/stripe/terminal/location_test.rb
stripe-4.6.0 test/stripe/terminal/location_test.rb
stripe-4.5.0 test/stripe/terminal/location_test.rb
stripe-4.4.1 test/stripe/terminal/location_test.rb
stripe-4.4.0 test/stripe/terminal/location_test.rb
stripe-4.3.0 test/stripe/terminal/location_test.rb
stripe-4.2.0 test/stripe/terminal/location_test.rb
stripe-4.1.0 test/stripe/terminal/location_test.rb
stripe-4.0.3 test/stripe/terminal/location_test.rb
stripe-4.0.2 test/stripe/terminal/location_test.rb
stripe-4.0.1 test/stripe/terminal/location_test.rb
stripe-4.0.0 test/stripe/terminal/location_test.rb
stripe-3.31.1 test/stripe/terminal/location_test.rb
stripe-3.31.0 test/stripe/terminal/location_test.rb
stripe-3.30.0 test/stripe/terminal/location_test.rb