Sha256: bac1e7713381b2e32dcb263dca880e548d4df0757ead24b4a2794cd87345e221

Contents?: true

Size: 690 Bytes

Versions: 7

Compression:

Stored size: 690 Bytes

Contents

require "spec_helper"
require "ribose/actions/fetch"

RSpec.describe "TestFetchAction" do
  describe ".fetch" do
    it "fetches a specific resource" do
      resource_id = 123_456_789

      stub_ribose_space_fetch_api(resource_id)
      resource = Ribose::TestFetchAction.fetch(resource_id)

      expect(resource.id).not_to be_nil
      expect(resource.name).to eq("Work")
    end
  end

  def stub_ribose_space_fetch_api(resource_id)
    stub_api_response(:get, "spaces/#{resource_id}", filename: "space")
  end

  module Ribose
    class TestFetchAction < Ribose::Base
      include Ribose::Actions::Fetch

      private

      def resource
        "space"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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