Sha256: 51c862e91229f3d34b9db4ed054a4e22c46e826d76afeb1abfe86e4012aab198

Contents?: true

Size: 747 Bytes

Versions: 9

Compression:

Stored size: 747 Bytes

Contents

RSpec.describe Rambo::RamlModels::SecurityScheme do
  let(:raml_file) { File.join(SPEC_DIR_ROOT, "support/secured_api.raml") }
  let(:raml)      { Raml::Parser.parse_file(raml_file).security_schemes.first }

  subject { described_class.new(raml, { token: "foobarbaz" }) }

  it { is_expected.to respond_to :title }

  describe "#headers" do
    it "is a Headers object" do
      expect(subject.headers).to be_a(Rambo::RamlModels::Headers)
    end

    it "uses the API token from the options" do
      expect(subject.headers.headers).to eql({ "Api-Token" => "foobarbaz" })
    end
  end

  describe "#api_token_header" do
    it "returns the key of a matching header" do
      expect(subject.api_token_header).to eql "Api-Token"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rambo_ruby-0.7.1 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.7.0 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.6.0 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.5.0 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.4.0 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.3.3 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.3.2 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.3.1 spec/lib/rambo/raml_models/security_scheme_spec.rb
rambo_ruby-0.3.0 spec/lib/rambo/raml_models/security_scheme_spec.rb