Sha256: d6c716a1d6f1108033f21bb0cf118743e09544e7814a19f260c9f29093bf7e7f

Contents?: true

Size: 966 Bytes

Versions: 24

Compression:

Stored size: 966 Bytes

Contents

require 'spec_helper.rb'

describe Stitches::ApiVersionConstraint do
  let(:version) { 2 }
  let(:request) { double("request", headers: headers) }

  subject(:constraint) { described_class.new(version) }

  context "no accept header" do
    let(:headers) { {} }
    it "doesn't match" do
      expect(constraint.matches?(request)).to eq(false)
    end
  end
  context "accept header missing version" do
    let(:headers) { { accept: "application/json" } }
    it "doesn't match" do
      expect(constraint.matches?(request)).to eq(false)
    end
  end
  context "accept header has wrong version" do
    let(:headers) { { accept: "application/json; version=1" } }
    it "doesn't match" do
      expect(constraint.matches?(request)).to eq(false)
    end
  end
  context "accept header has correct version" do
    let(:headers) { { accept: "application/json; version=2" } }
    it "matcheds" do
      expect(constraint.matches?(request)).to eq(true)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
stitches-4.0.2 spec/api_version_constraint_spec.rb
stitches-4.1.0RC2 spec/api_version_constraint_spec.rb
stitches-4.0.1 spec/api_version_constraint_spec.rb
stitches-4.0.0 spec/api_version_constraint_spec.rb
stitches-4.0.0.RC1 spec/api_version_constraint_spec.rb
stitches-3.8.3 spec/api_version_constraint_spec.rb
stitches-3.8.2 spec/api_version_constraint_spec.rb
stitches-3.8.1 spec/api_version_constraint_spec.rb
stitches-3.8.0 spec/api_version_constraint_spec.rb
stitches-3.7.3 spec/api_version_constraint_spec.rb
stitches-3.7.2 spec/api_version_constraint_spec.rb
stitches-3.7.0 spec/api_version_constraint_spec.rb
stitches-3.6.1 spec/api_version_constraint_spec.rb
stitches-3.6.0 spec/api_version_constraint_spec.rb
stitches-3.6.0.RC1 spec/api_version_constraint_spec.rb
stitches-3.5.0 spec/api_version_constraint_spec.rb
stitches-3.4.0 spec/api_version_constraint_spec.rb
stitches-3.3.0 spec/api_version_constraint_spec.rb
stitches-3.2.3 spec/api_version_constraint_spec.rb
stitches-3.2.2 spec/api_version_constraint_spec.rb