Sha256: 7bc1af49f0d659ebf4689b31ca602ed14f73d3aa10533f2db5e16f781f2399fa

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

RSpec.describe Ember::CLI::Deploy::Rack::Engine do
  let(:key_prefix) { app.settings.key_prefix }
  let(:redis)      { app.settings.redis_client }

  it 'response with 400 when revision is not valid' do
    revision = 'invalid-revision'

    get '/', revision: revision

    expect(last_response.status).to eq 400
  end

  context 'data available' do
    describe '/' do
      it 'returns the `current-content` revision as default' do
        revision = 'current-content'
        fixture  = File.expand_path "ember/cli/deploy/rack/engine/revisions/#{revision}.html", fixtures
        html     = IO.read fixture

        redis.set "#{key_prefix}:#{revision}", html

        get '/'

        expect(last_response).to be_ok
        expect(last_response.body).to eq html
      end

      it 'returns a specific revision' do
        revision = 'e56b0f2850be071697ab61c41ce8f3c0'
        fixture  = File.expand_path "ember/cli/deploy/rack/engine/revisions/#{revision}.html", fixtures
        html     = IO.read fixture

        redis.set "#{key_prefix}:#{revision}", html

        get '/', revision: revision

        expect(last_response).to be_ok
        expect(last_response.body).to eq html
      end
    end
  end

  context 'no data available' do
    describe '/' do
      it 'response with 404' do
        get '/'

        expect(last_response.status).to eq 404
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ember-cli-deploy-rack-2.4.4 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.4.3 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.4.2 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.4.1 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.4.0 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.3.2 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.3.1 spec/integration/ember/cli/deploy/rack/engine_spec.rb
ember-cli-deploy-rack-2.3.0 spec/integration/ember/cli/deploy/rack/engine_spec.rb