test/telnyx/sim_card_test.rb in telnyx-0.0.7 vs test/telnyx/sim_card_test.rb in telnyx-0.0.8

- old
+ new

@@ -3,32 +3,29 @@ require_relative "../test_helper" module Telnyx class SimCardTest < Test::Unit::TestCase should "retrieve sim card" do - stub = stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards/123") - .to_return(body: JSON.generate(data: { record_type: "sim_card", id: "123" })) sim = Telnyx::SimCard.retrieve "123" - assert_requested stub + assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards/123") assert_kind_of Telnyx::SimCard, sim end should "list sim cards" do - stub = stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards") - .to_return(body: JSON.generate(data: (1..5).map { |i| { record_type: "sim_card", id: i } })) simlist = Telnyx::SimCard.list - assert_requested stub + assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards") assert_kind_of Telnyx::ListObject, simlist end should "save sim card" do - stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards/123") - .to_return(body: JSON.generate(data: { record_type: "sim_card", id: "123" })) - stub = stub_request(:patch, "#{Telnyx.api_base}/v2/sim_cards/123") - .to_return(body: JSON.generate(data: { record_type: "sim_card", id: "123" })) sim = Telnyx::SimCard.retrieve "123" sim.save - assert_requested stub + assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards/123") + end + + should "register sim card" do + Telnyx::SimCard.register(registration_codes: %w[1234567890 123456332601]) + assert_requested(:post, "#{Telnyx.api_base}/v2/actions/register/sim_cards") end context "actions" do should "deactivate" do stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards/123")