Sha256: 57719136afd214452401ccc304bf3e1310ced7e342ed8acc5a005b52fa73c7d3

Contents?: true

Size: 839 Bytes

Versions: 10

Compression:

Stored size: 839 Bytes

Contents

require 'spec_helper'

describe VersionCake::QueryParameterStrategy do
  let(:strategy) { VersionCake::QueryParameterStrategy.new }
  subject { strategy.extract(request) }

  context "a request with an api_version parameter retrieves the version" do
    let(:request) { instance_double('Request', GET: {'api_version' => '11', 'other' => 'parameter'}) }

    it { is_expected.to eq 11 }
  end

  context "a request with an Integer api_version parameter retrieves the version" do
    let(:request) { instance_double('Request', GET: {'api_version' => 11, 'other' => 'parameter'}) }

    it { is_expected.to eq 11 }
  end

  context "a request without an api_version parameter returns nil" do
    let(:request) { instance_double('Request', GET: {'other' => 'parameter', 'another' => 'parameter'}) }

    it { is_expected.to be_nil }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
versioncake-4.1.1 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-4.1.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-4.0.2 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-4.0.1 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-4.0.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-3.4.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-3.3.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-3.2.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-3.1.0 spec/unit/strategies/query_parameter_strategy_spec.rb
versioncake-3.0.0 spec/unit/strategies/query_parameter_strategy_spec.rb