Sha256: fcf0916705ab53d45aefb5527b2078268a90220e4b26c5f98e20e51ab6f07802

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

require 'spec_helper'

describe Berkshelf::API::Endpoint::V1 do
  include Rack::Test::Methods
  include Berkshelf::API::Mixin::Services

  before { Berkshelf::API::CacheManager.start }
  let(:app) { described_class.new }

  describe "GET /universe" do
    context "the cache has been warmed" do
      before { cache_manager.set_warmed; get '/universe' }

      subject { last_response }
      let(:app_cache) { cache_manager.cache }

      its(:status) { should be(200) }
      its(:body) { should eq(app_cache.to_json) }
    end

    context "the cache is still warming" do
      before { get '/universe' }

      subject { last_response }
      let(:app_cache) { cache_manager.cache }

      its(:status) { should be(503) }
      its(:headers) { should have_key("Retry-After") }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
berkshelf-api-1.1.0 spec/unit/berkshelf/api/endpoint/v1_spec.rb
berkshelf-api-1.0.0 spec/unit/berkshelf/api/endpoint/v1_spec.rb