Sha256: 5942c5d809174658b0cd66bfab47b9e93e6a2b87fbc94de785f4da62ada7d511

Contents?: true

Size: 1.51 KB

Versions: 22

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

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

module Stripe
  module Terminal
    class ReaderTest < Test::Unit::TestCase
      should "be creatable" do
        reader = Stripe::Terminal::Reader.create(
          registration_code: "elegant-orange-aqua",
          label: "label"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers"
        assert reader.is_a?(Stripe::Terminal::Reader)
      end

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

      should "be retrievable" do
        reader = Stripe::Terminal::Reader.retrieve("rdr_123")
        assert_requested :get, "#{Stripe.api_base}/v1/terminal/readers/rdr_123"
        assert reader.is_a?(Stripe::Terminal::Reader)
      end

      should "be saveable" do
        reader = Stripe::Terminal::Reader.retrieve("rdr_123")
        reader["label"] = "new label"
        reader.save
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/rdr_123"
        assert reader.is_a?(Stripe::Terminal::Reader)
      end

      should "be updateable" do
        reader = Stripe::Terminal::Reader.update("rdr_123", label: "new label")
        assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/rdr_123"
        assert reader.is_a?(Stripe::Terminal::Reader)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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