Sha256: 47f7ef7a3abd80bbcf3ec63fdc9181082619bc4dde864788a4d5fcf1297f4c6d

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

require 'spec_helper'

describe VersionCake::VersionedRequest do
  context '#execute' do
    let(:request) { double 'Request' }
    let(:strategies) { [ instance_double('ExtractionStrategy', extract: request_version) ] }

    subject(:versioned_request) do
      request = VersionCake::VersionedRequest.new request, strategies
      request.execute
      request
    end

    context 'with a supported version' do
      let(:request_version) { 2 }

      it { expect(versioned_request.version).to eq 2 }
      it { expect(versioned_request.failed).to be_falsey }
    end

    context 'without a version' do
      let(:request_version) { nil }

      it { expect(versioned_request.version).to be_nil }
      it { expect(versioned_request.failed).to be_falsey }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
versioncake-4.1.1 spec/unit/versioned_request_spec.rb
versioncake-4.1.0 spec/unit/versioned_request_spec.rb