Sha256: 70916b7329d2df8592770fdd9ff87e466117120d69c694ab7a8416ea78823cbb

Contents?: true

Size: 865 Bytes

Versions: 7

Compression:

Stored size: 865 Bytes

Contents

require "spec_helper"
require "ribose/actions/update"

RSpec.describe "TestUpdateAction" do
  describe ".update" do
    it "updates a resource with provided details" do
      resource_id = 123_456_789
      attributes = { attribute_name: "attribute_value" }

      stub_ribose_resource_update_api_call(resource_id, attributes)
      resource = Ribose::TestUpdateAction.update(resource_id, attributes)

      expect(resource.id).not_to be_nil
    end
  end

  module Ribose
    class TestUpdateAction < Ribose::Base
      include Ribose::Actions::Update

      private

      def resource
        "space"
      end
    end
  end

  def stub_ribose_resource_update_api_call(resource_id, attributes)
    resource_path = ["spaces", resource_id].join("/")

    stub_api_response(
      :put, resource_path, data: { space: attributes }, filename: "space"
    )
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ribose-0.5.0 spec/ribose/actions/update_spec.rb
ribose-0.4.1 spec/ribose/actions/update_spec.rb
ribose-0.4.0 spec/ribose/actions/update_spec.rb
ribose-0.3.2 spec/ribose/actions/update_spec.rb
ribose-0.3.1 spec/ribose/actions/update_spec.rb
ribose-0.3.0 spec/ribose/actions/update_spec.rb
ribose-0.2.0 spec/ribose/actions/update_spec.rb